0% found this document useful (0 votes)
15 views

NET Framework

.Net Framework documentation

Uploaded by

Telesco T
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

NET Framework

.Net Framework documentation

Uploaded by

Telesco T
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

.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 in .NET are executed in the execution environment, which is called CLR
(Common Language Runtime). These are the core and 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.

Following is the .NET framework Stack that shows the modules and components of the Framework.

The .NET Framework is composed of four main components:

1. Common Language Runtime (CLR)

2. Framework Class Library (FCL),

3. Core Languages (WinForms, ASP.NET, and ADO.NET), and

4. Other Modules (WCF, WPF, WF, Card Space, LINQ, Entity Framework, Parallel LINQ, Task Parallel
Library, etc.)
CLR (Common Language Runtime)

It is a program execution engine that loads and executes the program. It converts the program into
native code. It acts as an interface between the framework and operating system. It does exception
handling, memory management, and garbage collection. Moreover, it provides security, type-safety,
interoperability, and portablility. A list of CLR components are given below:

FCL (Framework Class Library)

It is a standard library that is a collection of thousands of classes and used to build an application. The
BCL (Base Class Library) is the core of the FCL and provides basic functionalities.
WinForms

Windows Forms is a smart client technology for the .NET Framework, a set of managed libraries that
simplify common application tasks such as reading and writing to the file system.

ASP.NET

ASP.NET is a web framework designed and developed by Microsoft. It is used to develop websites, web
applications, and web services. It provides a fantastic integration of HTML, CSS, and JavaScript. It was
first released in January 2002.

ADO.NET

ADO.NET is a module of .Net Framework, which is used to establish a connection between application
and data sources. Data sources can be such as SQL Server and XML. ADO .NET consists of classes that can
be used to connect, retrieve, insert, and delete data.

WPF (Windows Presentation Foundation)

Windows Presentation Foundation (WPF) is a graphical subsystem by Microsoft for rendering user
interfaces in Windows-based applications. WPF, previously known as "Avalon", was initially released as
part of .NET Framework 3.0 in 2006. WPF uses DirectX.

WCF (Windows Communication Foundation)


It is a framework for building service-oriented applications. Using WCF, you can send data as
asynchronous messages from one service endpoint to another.

WF (Workflow Foundation)

Windows Workflow Foundation (WF) is a Microsoft technology that provides an API, an in-process
workflow engine, and a rehostable designer to implement long-running processes as workflows
within .NET applications.

LINQ (Language Integrated Query)

It is a query language, introduced in .NET 3.5 framework. It is used to make the query for data sources
with C# or Visual Basics programming languages.

Entity Framework

It is an ORM based open source framework which is used to work with a database using .NET objects. It
eliminates a lot of developers effort to handle the database. It is Microsoft's recommended technology
to deal with the database.

Parallel LINQ

Parallel LINQ or PLINQ is a parallel implementation of LINQ to objects. It combines the simplicity and
readability of LINQ and provides the power of parallel programming.

It can improve and provide fast speed to execute the LINQ query by using all available computer
capabilities.

Apart from the above features and libraries, .NET includes other APIs and Model to improve and
enhance the .NET framework.

In 2015, Task parallel and Task parallel libraries were added. In .NET 4.5, a task-based asynchronous
model was added.

.NET Common Language Runtime (CLR)

.NET CLR is a runtime environment that manages and executes the code written in any .NET
programming language. CLR is the virtual machine component of the .NET framework. That language's
compiler compiles the source code of applications developed using .NET compliant languages into CLR's
intermediate language called MSIL, i.e., Microsoft intermediate language code. This code is platform-
independent. It is comparable to byte code in java. Metadata is also generated during compilation and
MSIL code and stored in a file known as the Manifest file. This metadata is generally about members and
types required by CLR to execute MSIL code. A just-in-time compiler component of CLR converts MSIL
code into native code of the machine. This code is platform-dependent. CLR manages memory, threads,
exceptions, code execution, code safety, verification, and compilation.

The following figure shows the conversion of source code into native code.
The above figure converts code into native code, which the CPU can execute.

The main components of CLR are:

o Common type system

o Common language speciation

o Garbage Collector

o Just in Time Compiler

o Metadata and Assemblies

1. Common type system:

CTS provides guidelines for declaring, using, and managing data types at runtime. It offers cross-language
communication. For example, VB.NET has an integer data type, and C# has an int data type for managing
integers. After compilation, Int32 is used by both data types. So, CTS provides the data types using
managed code. A common type system helps in writing language-independent code.

It provides two categories of Types.

1. Value Type: A value type stores the data in memory allocated on the stack or inline in a
structure. This category of Type holds the data directory. If one variable's value is copied to
another, both the variables store data independently. It can be of inbuilt-in types, user-defined,
or enumerations types. Built-in types are primitive data types like numeric, Boolean, char, and
date. Users in the source code create user-defined types. An enumeration refers to a set of
enumerated values represented by labels but stored as a numeric type.

2. Reference Type: A Reference type stores a reference to the value of a memory address and is
allocated on the heap. Heap memory is used for dynamic memory allocation. Reference Type
does not hold actual data directly but holds the address of data. Whenever a reference type
object is made, it copies the address and not actual data. Therefore two variables will refer to
the same data. If data of one Reference Type object is changed, the same is reflected for the
other object. Reference types can be self-describing types, pointer types, or interference types.
The self-describing types may be string, array, and class types that store metadata about
themselves.

2. Common Language Specification (CLS):

Common Language Specification (CLS) contains a set of rules to be followed by all NET-supported
languages. The common rules make it easy to implement language integration and help in cross-
language inheritance and debugging. Each language supported by NET Framework has its own syntax
rules. But CLS ensures interoperability among applications developed using NET languages.

3. Garbage Collection:

Garbage Collector is a component of CLR that works as an automatic memory manager. It helps manage
memory by automatically allocating memory according to the requirement. It allocates heap memory to
objects. When objects are not in use, it reclaims the memory allocated to them for future use. It also
ensures the safety of objects by not allowing one object to use the content of another object.

4. Just in Time (JIT) Compiler:


JIT Compiler is an important component of CLR. It converts the MSIL code into native code (i.e., machine-
specific code). The .NET program is compiled either explicitly or implicitly. The developer or programmer
calls a particular compiler to compile the program in the explicit compilation. In implicit compilation, the
program is compiled twice. The source code is compiled into Microsoft Intermediate Language (MSIL)
during the first compilation process. The MSIL code is converted into native code in the second
compilation process. This process is called JIT compilation. There are three types of JIT compilers -Pre,
Econo, and Normal. Pre JIT Compiler compiles entire MSIL code into native code before execution. Econo
JIT Compiler compiles only those parts of MSIL code required during execution and removes those parts
that are not required anymore. Normal JIT Compiler also compiles only those parts of MSIL code
required during execution but places them in cache for future use. It does not require recompilations of
already used parts as they have been placed in cache memory.

5. Metadata:

A Metadata is a binary information about the program, either stored in a CLR Portable Executable file
(PE) along with MSIL code or in the memory. During the execution of MSIL, metadata is also loaded into
memory for proper interpretation of classes and related. Information used in code. So, metadata helps
implement code in a language-neutral manner or achieve language interoperability.

6. Assemblies:

An assembly is a fundamental unit of physical code grouping. It consists of the assembly manifest,
metadata, MSIL code, and a set of resources like image files. It is also considered a basic deployment
unit, version control, reuse, security permissions, etc.

.NET CLR Functions

Following are the functions of the CLR.

o It converts the program into native code.

o Handles Exceptions

o Provides type-safety

o Memory management

o Provides security

o Improved performance

o Language independent

o Platform independent

o Garbage collection

o Provides language features such as inheritance, interfaces, and overloading for object-oriented
programs.
The code that runs with CLR is called managed code, whereas the code outside the CLR is called
unmanaged code. The CLR also provides an Interoperability layer, which allows both the managed and
unmanaged codes to interoperate.

1. Managed code:

Any language that is written in the .NET framework is managed code. Managed code use CLR, which
looks after your applications by managing memory, handling security, allowing cross-language
debugging, etc. The process of managed code is shown in the figure:

2. Unmanaged code:

The code developed outside the .NET framework is known as unmanaged code. Applications that do not
run under the control of the CLR are said to be unmanaged. Certain languages such as C++ can be used
to write such applications, such as low-level access functions of the operating system. Background
compatibility with VB, ASP, and COM are examples of unmanaged code. This code is executed with the
help of wrapper classes. The unmanaged code process is shown below:
.NET CLR Versions

The CLR updates itself time to time to provide better performance.

.NET version CLR version

1.0 1.0

1.1 1.1

2.0 2.0

3.0 2.0

3.5 2.0

4 4

4.5 4
4.6 4

4.6 4

.NET CLR Structure

Following is the component structure of Common Language Runtime.

Base Class Library Support

It is a class library that supports classes for the .NET application.

Thread Support

It manages the parallel execution of the multi-threaded application.

COM Marshaler

It provides communication between the COM objects and the application.

Security Engine

It enforces security restrictions.

Debug Engine
It allows you to debug different kinds of applications.

Type Checker

It checks the types used in the application and verifies that they match the standards provided by the
CLR.

Code Manager

It manages code at execution runtime.

Garbage Collector

It releases the unused memory and allocates it to a new application.

Exception Handler

It handles the exception at runtime to avoid application failure.

ClassLoader

It is used to load all classes at run time.

.NET Framework Class Library

.NET Framework Class Library is the collection of classes, namespaces, interfaces and value types that
are used for .NET applications.

It contains thousands of classes that supports the following functions.

o Base and user-defined data types

o Support for exceptions handling

o input/output and stream operations

o Communications with the underlying system

o Access to data

o Ability to create Windows-based GUI applications

o Ability to create web-client and server applications

o Support for creating web services

.NET Framework Class Library Namespaces


Following are the commonly used namespaces that contains useful classes and interfaces and defined in
Framework Class Library.

Namespaces Description

It includes all common datatypes, string


System values, arrays and methods for data
conversion.

System.Data, System.Data.Common, These are used to access a database, perform


System.Data.OleDb, System.Data.SqlClient, commands on a database and retrieve
System.Data.SqlTypes database.

System.IO, System.DirectoryServices,
These are used to access, read and write files.
System.IO.IsolatedStorage

It is used to debug and trace the execution of


System.Diagnostics
an application.

These are used to communicate over the


System.Net, System.Net.Sockets Internet when creating peer-to-peer
applications.

These namespaces are used to create


System.Windows.Forms,
Windows-based applications using Windows
System.Windows.Forms.Design
user interface components.

System.Web, System.WebCaching,
System.Web.UI, System.Web.UI.Design,
System.Web.UI.WebControls,
These are used to create ASP. NET Web
System.Web.UI.HtmlControls,
applications that run over the web.
System.Web.Configuration,
System.Web.Hosting, System.Web.Mail,
System.Web.SessionState

System.Web.Services,
System.Web.Services.Description, These are used to create XML Web services
System.Web.Services.Configuration, and components that can be published over
System.Web.Services.Discovery, the web.
System.Web.Services.Protocols
System.Security, System.Security.Permissions,
These are used for authentication,
System.Security.Policy, System.WebSecurity,
authorization, and encryption purpose.
System.Security.Cryptography

System.Xml, System.Xml.Schema,
These namespaces are used to create and
System.Xml.Serialization, System.Xml.XPath,
access XML files.
System.Xml.Xsl

.NET Framework Base Class Library

.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.

You might also like