The .NET Framework is the infrastructure for the Microsoft .NET platform. The .NET Framework is an environment for building, deploying, and running Web applications and Web Services.
- Features of .NET Frameworks:
- Easier and quicker programming
- Reduced amount of code
- Richer server control hierarchy with events
- Larger class library
- Better support for development tools
The .NET Framework consists of 3 main parts:
· Programming languages(c#,j#,vb.net):
· Server technologies and client technologies (asp.net, window form, mobile solution):
· Development environments (vs.net, visual web developer):
The .NET Framework has two main components: the common language runtime (CLR) and .NET Framework class library. The CLR is the foundation of the .NET framework and provides a common set of services for projects that act as building blocks to build up applications across all tiers. It simplifies development and provides a robust and simplified environment which provides common services to build application. The .NET framework class library is a collection of reusable types and exposes features of the runtime. It contains of a set of classes that is used to access common functionality.
The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime's functionality and enable you to write code that benefits from this managed execution environment. The code that runs within the common language runtime is called managed code.
When the code is compiled, the compiler translates your code into Microsoft intermediate language (MSIL). The common language runtime includes a JIT compiler for converting this MSIL then to native code.
MSIL contains metadata that is the key to cross language interoperability. Since this metadata is standardized across all .NET languages, a program written in one language can understand the metadata and execute code, written in a different language. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations.
JIT is a compiler that converts MSIL to native code. The native code consists of hardware specific instructions that can be executed by the CPU.
Rather than converting the entire MSIL (in a portable executable [PE] file) to native code, the JIT converts the MSIL as it is needed during execution. This converted native code is stored so that it is accessible for subsequent calls.
When we write a program in .NET compatible language, then the compiler compiles the code in MSIL (Microsoft Intermediate Language) and then MSIL will be the input of CLR's component Just in Time compiler to produce machine independent code.
Apart from the above CLR is also responsible for:
· Memory management
· Thread management
· Exception handling
· Garbage collection