Saturday, May 25, 2013

Introduction to .NET Framework

The .NET Framework is the heart of Microsoft .NET. The .NET Framework is a software development platform of Microsoft .NET. Like any platform, it provides a run-time, defines functionality in some libraries, and supports a set of programming languages. The .NET Framework provides the necessary compile-time and run-time foundation to build and run .NET-based applications.

Components of .NET Framework:


The .NET Framework consists of:

• Common Language Runtime
• Class Libraries
• Support for Multiple Programming Language


Application Development and Execution





  1. Developing application:
Since Microsoft .NET is a Multilingual platform then any.NET based language can be chosen to develop applications. Comfort ability of application programmers, specific requirement of applications may be the major factors in selection of language.


  1. Choosing a Compiler
According to the language we can choose its run time aware compiler for .NET platform. Because it is a Multilanguage execution environment, the runtime supports a wide variety of data types and language features.


  1. Compiling to MSIL
When compiling your source code, the compiler translates it into an intermediate code represented in Microsoft intermediate language (MSIL). Before code can be run, MSIL code must be converted to CPU-specific code, usually by a just-in-time (JIT) compiler. When a compiler produces MSIL, it also produces metadata. Metadata includes following information.
• Description of the types in your code, including the definition of each type,
• The signatures of each type's members,
• The members that your code references,
• Other data that the runtime uses at execution time.
The MSIL and metadata are contained in a portable executable (PE) file that is based on and extends the published Microsoft PE and common object file format (COFF) used historically for executable content. This file format, which accommodates MSIL or native code as well as metadata, enables the operating system to recognize common language runtime images.


  1. JIT Compilation to Native code:
The MSIL code is compiled into native code by component of CLR named JIT Compiler. JIT compiler intelligently guesses and compiles the intermediate code on piece by piece basis. This piece may be a method or a set of methods. Before a method can be run, it must be compiled to processor-specific code. Each method for which Microsoft intermediate language (MSIL) has been generated is just-in-time-compiled (JIT-compiled) when it is called for the first time, and then run. The next time the method is run, the existing JIT -compiled native code is run. The process of JIT -compiling and then executing the code is repeated until execution is complete.


  1. Type Safety Checking:
As part of compiling MSIL to native code, code must pass a verification process unless an administrator has established a security policy that allows code to bypass verification. Verification examines MSIL and metadata to find out whether the code is type safe, which means that it only accesses the memory locations it is authorized to access. Additionally, verification inspects code to determine whether the MSIL has been correctly generated, because incorrect MSIL can lead to a violation of the type safety rules. If type-safe code is required by security policy and the code does not pass verification, an exception is thrown when the code is run.


  1. Code execution under CLR:
The common language runtime is responsible for providing following low-level execution services, such as garbage collection, exception handling, security services, and runtime type safety checking. Because of the common language runtime's role in managing execution, programs that target the .NET Framework are sometimes called "managed" applications.


Features of .NET Framework

• It is a platform neutral framework.
• It is a layer between the operating system and the programming language.
• It supports many programming languages, including VB.NET, C# etc.
• .NET provides a common set of class libraries, which can be accessed from any .NET based programming language. There will not be separate set of classes and libraries for each language. If you know anyone .NET language, you can write code in any .NET language.
• In future versions of Windows, .NET will be freely distributed as part of operating system and users will never have to install .NET separately.

No comments:

Post a Comment