Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

Department of

Unit : 1 Information Technology


Unit no.: 1

Unit title: Introduction


Introduction To .Net Architecture To .Net Architecture

.NET TECHNOLOGY
[01IT0605]

Asst. Prof. Divya Kavathiya


 .NET is a framework to develop software applications. It is
designed and developed by Microsoft and the first beta version
released in 2000.
 It is used to develop applications for web, Windows, phone.
Moreover, it provides a broad range of functionalities and support.
 This framework contains a large number of class libraries known
as Framework Class Library (FCL). The software programs written
.NET in .NET are executed in the execution environment, which is called
CLR (Common Language Runtime). These are the core and
framework essential parts of the .NET framework.
 This framework provides various services like memory
management, networking, security, memory management, and
type-safety.
 The .Net Framework supports more than 60 programming
languages such as C#, F#, VB.NET, J#, VC++, JScript.NET, APL,
COBOL, Perl, Oberon, ML, Pascal, Eiffel, Smalltalk, Python, Cobra,
ADA, etc.
. Net
Framework
Architecture
Components of .NET Framework :
 There are following components of .NET Framework:
1. CLR (Common Language Runtime)
2. CTS (Common Type System)
. Net 3. BCL (Base Class Library)
Framework 4. CLS (Common Language Specification)

Architecture 5. FCL (Framework Class Library)


6. .NET Assemblies
7. XML Web Services
8. Window Services
1. CLR (Common Language Runtime): It is an important part of a
.NET framework that works like a virtual component of the
.NET Framework to executes the different languages program
like c#, Visual Basic, etc. A CLR also helps to convert a source
code into the byte code, and this byte code is known as CIL
(Common Intermediate Language) or MSIL (Microsoft
Intermediate Language). After converting into a byte code, a
CLR uses a JIT compiler at run time that helps to convert a CIL
or MSIL code into the machine or native code.
Components
of .NET
Framework :
2. CTS (Common Type System) : It specifies a standard that
represent what type of data and value can be defined and managed
Components in computer memory at runtime. A CTS ensures that programming
data defined in various languages should beinteract with each other
of .NET to share information. For example, in C# we define data type as int,
Framework : while in VB.NET we define integer as a data type.
3. BCL (Base Class Library) : The base class library has a rich
collection of libraries features and functions that help to implement
many programming languages in the .NET Framework, such as C
#, F #, Visual C ++, and more. Furthermore, BCL divides into two
parts:
 User defined class library
 Assemblies - It is the collection of small parts of deployment an
application's part. It contains either the DLL (Dynamic Link Library)
Components or exe (Executable) file.
 In LL, it uses code reusability, whereas in exe it contains only output
of .NET file/ or application.
 DLL file can't be open, whereas exe file can be open.
Framework  DLL file can't be run individually, whereas in exe, it can run
individually.
 In DLL file, there is no main method, whereas exe file has main
method.

 Predefined class library :


 Namespace - It is the collection of predefined class and method that
present in .Net. In other languages such as, C we used header files,
in java we used package similarly we used "using system" in .NET,
where using is a keyword and system is a namespace.
.NET Base Class Library is the sub part of the Framework that provides
library support to Common Language Runtime to work properly. It
includes the System namespace and core types of the .NET framework.

Components
of .NET
Framework
4. CLS (Common language Specification) : It is a subset of common
type system (CTS) that defines a set of rules and regulations which
should be followed by every language that comes under the .net
framework. In other words, a CLS language should be cross-
language integration or interoperability. For example, in C# and
VB.NET language, the C# language terminate each statement with
semicolon, whereas in VB.NET it is not end with semicolon, and
when these statements execute in .NET Framework, it provides a
Components common platform to interact and share information with each
other.
of .NET 5. Microsoft .NET Assemblies : A .NET assembly is the main
Framework : building block of the .NET Framework. It is a small unit of code that
contains a logical compiled code in the Common Language
infrastructure (CLI), which is used for deployment, security and
versioning. It defines in two parts (process) DLL and library (exe)
assemblies. When the .NET program is compiled, it generates a
metadata with Microsoft Intermediate Language, which is stored in
a file called Assembly.
6. FCL (Framework Class Library) :
 It provides the various system functionality in the .NET
Framework, that includes classes, interfaces and data types, etc.
to create multiple functions and different types of application such
as desktop, web, mobile application, etc. In other words, it can be
defined as, it provides a base on which various applications,
controls and components are built in .NET Framework.
 Key Components of FCL
Components
 Object type
of .NET  Implementation of data structure
Framework :  Base data types
 Garbage collection
 Security and database connectivity
 Creating common platform for window and web-based
application
 The garbage collector (GC) manages the allocation and release of
memory. The garbage collector serves as an automatic memory
manager.
 You do not need to know how to allocate and release memory or
manage the lifetime of the objects that use that memory
Garbage  An allocation is made any time you declare an object with a “new”
Collection keyword or a value type is boxed. Allocations are typically very fast
 When there isn’t enough memory to allocate an object, the GC
must collect and dispose of garbage memory to make memory
available for new allocations.
 This process is known as garbage collection.
 Following are the commonly used namespaces that contains
useful classes and interfaces and defined in Framework Class
Library.

.NET
Namespace
.NET
Namespace
 In C#, string is an object of System.String class that represent
sequence of characters. We can perform many operations on
strings such as concatenation, comparision, getting substring,
search, trim, replacement etc.
 string vs String :

String  In C#, string is keyword which is an alias for System.String class.


That is why string and String are equivalent. We are free to use any
Manipulation naming convention.
 string s1 = "hello";//creating string using string keyword
 String s2 = "welcome";//creating string using String class
 Side-by- side execution is the ability to run multiple versions of an
application or component on the same computer.
 You can have multiple versions of the common language runtime,
and multiple versions of applications and components that use a
version of the runtime, on the same computer at the same time.

Side by Side
Execution
 The following illustration shows several applications using two
different versions of a component on the same computer.
Application A and B use version 1.0 of the component while
Application C uses version 2.0 of the same component.

Side by Side
Execution
 DLL Hell is a situation in which two separate applications share a
common assembly, and if one of the applications makes
modifications to the common assembly that isn't backward
compatible, the other application crashes.
 Let's look at an example to better understand this. Imagine you
have two applications, Application1 and Application2, and both of
them share a common Assembly, which we'll refer to as Shared.
 Now, GetOperation is used by both applications ().

DLL HELL
PROBLEM

 Now, both applications are up and running. However, after a while,


Application2 decides to update itself. During the modification,
Application2 renames the GetOperation() function in Shared
assembly to GetOperationNew(). After that, Application2 works
fine because it calls GetOperationNew() from Shared Assembly,
whereas Application1 crashes. This is referred to as the DLL hell
problem.
 In .Net, all the shared assemblies are stored in Global Assembly
Cache (GAC).
 Each shared assemblies have a unique name and version defined.
So, when any application is updated with new version, a new
shared assembly file is created for that application only; while
DLL hell other older applications use an older assembly file for execution.
solution  For e.g., A1 and A2 applications use shared.dll version 2.0 stored in
GAC for execution. Now, if A2 gets updated, then a new shared.dll
file will be created with version 3.0 in GAC.
 Thus, A2 will use newer assembly file and A1 will use older
assembly file.
 The above concept is known as End to Hell DLL.
 CLR executed code is called managedcode.
 Contains meta data like description of classes, interfaces,
properties, fields, methods, parameters,etc.
 Object-oriented
Code Manager  Secure
 Reliable
 Allows integration between components and data types of
different programming languages.
 The code, which is developed outside .NET, Framework is known
as unmanaged code.
 Applications that do not run under the control of the CLR are said
to be unmanaged, and certain languages such as C++ can be used
to write such applications, which, for example, access low - level
functions of the operating system.
Code Manager  No information about the code/program is stored.
 Does not support object-oriented approach.
 Not Secure
 Not Reliable
 Need specific Datatypes and Programming Components for
execution in different environment.
 The Component Object Model (COM) lets an object expose its
functionality to other components and to host applications on
Windows platforms.
 To help enable users to interoperate with their existing code
bases, .NET Framework has always provided strong support for
COM InterOp interoperating with COM libraries.
 In .NET Core 3.0, a large portion of this support has been added to
.NET Core on Windows. The documentation here explains how the
common COM interop technologies work and how you can utilize
them to interoperate with your existing COM libraries.
 Files :
 A file is a collection of data stored in a disk with a specific name
and a directory path. When a file is opened for reading or writing,
it becomes a stream.
 The stream is basically the sequence of bytes passing through the
communication path. There are two main streams: the input
stream and the output stream. The input stream is used for
File I/O reading data from file (read operation) and the output stream is
used for writing into the file (write operation).
 C# I/O Classes :
 The System.IO namespace has various classes that are used for
performing numerous operations with files, such as creating and
deleting files, reading from or writing to a file, closing a file etc.
 The following table shows some commonly used non-abstract
classes in the System.IO namespace −
1. BinaryReader - Reads primitive data from a binary stream.
2. BinaryWriter -Writes primitive data in binary format.
3. BufferedStream -A temporary storage for a stream of bytes.
4. Directory -Helps in manipulating a directory structure.
5. DirectoryInfo -Used for performing operations on directories.
6. DriveInfo -Provides information for the drives.
7. File -Helps in manipulating files.

File I/O 8. FileInfo - Used for performing operations on files.


9. FileStream - Used to read from and write to any location in a file.
10. MemoryStream -Used for random access to streamed data stored
in memory.
11. Path -Performs operations on path information.
12. StreamReader -Used for reading characters from a byte stream
13. StreamWriter -Is used for writing characters to a stream.
14. StringReader -Is used for reading from a string buffer.
15. StringWriter -Is used for writing into a string buffer.
 In C#, collection represents group of objects. By the help of
collections, we can perform various operations on objects such as
 store object
 update object
 delete object
 retrieve object
Collections  search object, and
 sort object
 In sort, all the data structure work can be performed by C#
collections.
 We can store objects in array or collection. Collection has
advantage over array. Array has size limit but objects stored in
collection can grow or shrink dynamically.
 Types of Collections in C#
 There are 3 ways to work with collections. The three namespaces
are given below:
 System.Collections.Generic classes:(List, Stack, Queue,
LinkedList, HashSet, SortedSet, Dictionary, SortedDictionary,
SortedList).
Collections  System.Collections classes (Now deprecated) : (ArrayList, Stack,
Queue, Hashtable)
 System.Collections.Concurrent classes : (BlockingCollection,
ConcurrentBag, ConcurrentStack, ConcurrentQueue,
ConcurrentDictionary, Partitioner, Partitioner,
OrderablePartitione).
Thank You

You might also like