Saturday, July 26, 2014

.NET Framework


The .NET Framework defines an environment that supports the development and executionof highly distributed, component-based applications.The Microsoft .NET Framework is a software framework that can be installed on computers running Windows operating systems.
.NET Framework has 2 very important entities.

1)One is the Common Language Runtime (CLR).It manages the execution of your program. Along with other benefits, the Common Language Runtime is the part of the .NET Framework that enables programs to be portable. The CLR also provides other important services such as security, memory management, and exception handling. All .NET programs execute under the supervision of the CLR.

2) Other entity is .NET class library. This library gives your program access to the runtime environment. The .NET Framework includes a set of standard class libraries. The class library is organized in a hierarchy of namespaces. The .NET class libraries are available to all .NET languages. e.g. I/O Functionality, Database Connectivity API's When we compile a C# program, compiler produces pseudocode called Microsoft Intermediate Language (MSIL), intermediate code. MSIL is a set of portable instructions that are independent of any specific CPU. Then CLR translate the MSIL into executble code when program is run. These instructions i.e. MSIL is independent of any specific CPU. This is how .NET Framework achieves portabilty. CLR translate MSIL into exe using Just In Time (JIT) compiler. When a .NET program is executed, the CLR activates the JIT compiler. The JIT compiler converts MSIL into native code on demand basis.

One other thing which is output of compilation of a C# program, metadata.
Metadata describes the data used by your program and enables your code to
interact easily with other code. The metadata is contained in the same file as the MSIL
but developers can create their own metadata through custom attributes. Metadata contains information about the assembly.

There are two types of code i) Managed Code ii) Unmanaged Code
Managed code is executed under CLR. Unmanaged code is not executed under management of CLR. eg Pointers in c,c++.

Common Language Specification (CLS) :-
If you want your program to be used by other program written in different languages,
then your program should satisfy CLS. It includes Common Type System (CTS).
The Common Type System (CTS) is a standard that specifies how Type definitions and specific values of Types are represented .
CTS enable cross-language integration & also defines the rules that languages must follow, which helps ensure that objects written in different languages can interact with each other.


Functions of the Common Type System are :-
1) cross-language integration, type safety, and high performance code execution.
2) provides an object-oriented model that supports the complete implementation of many programming languages.
3) To ensure that objects written in different languages can interact with each other.



No comments:

Post a Comment