.NET Framework Components

.NET Framework Components

The .NET framework is a collection of classes and the platform that runs your applications. The .NET framework is made up of a number of components.

Term Description
Microsoft Intermediate Language (MSIL)

All .NET programs compile to Microsoft Intermediate Language (MSIL) or IL. Remember these key points about IL:

  • C# programs are compiled to IL.
  • IL is similar to Java's byte code.
  • IL allows for language interoperability.
  • IL allows platform independence.
Common Language Runtime (CLR)

The Common Language Runtime (CLR) executes IL code. The CLR is the execution environment for all .NET applications.

  • The CLR is similar to the Java JVM (Java Virtual Machine).
  • The CLR provides a managed environment for code execution.
    • A managed environment makes the code more secure by protecting the code from doing things, such as illegal memory access operations.
    • A managed environment manages memory for the program.
    • A managed environment adds additional runtime support not available in native programs, like garbage collection.
  • The CLR executes IL code.
    • Note: The CLR uses a Just In Time compiler (JIT) to compile MSIL code to native code. The JIT considerably improves the performance and speed of .NET programs. The JIT is the reason .NET programs are fast.
  • The CLR provides a host of services to .Net applications, including:
    • Input/Output support.
    • Multi threading support
Common Type System (CTS)

In order to support language interoperability, the .Net framework contains a Common Type System (CTS). The CTS defines types that are common to all .NET languages. For example, Int32 is a common type. In C# this type is referred to by using the int keyword, while Visual Basic .Net uses the integer keyword.

.NET Library

The .NET class libraries are pre-written classes that provide a rich assortment of pre-defined code.

  • All classes in the .NET libraries are organized into namespaces.
  • Most of the classes in the .NET library can be found in the System namespace.
Assembly

In .NET, an assembly is the smallest distributable unit.

  • Assemblies compile down to either a managed executable (.exe) or a managed dll (.dll).
  • Assemblies contain the IL code pertaining to a dll or executable.
  • Assemblies have a resource file. This file contains resources such as images for the assembly to use.
  • Assemblies have Meta Data about the assembly.
    • Meta Data stores all of the necessary information to allow other .Net assemblies to interact.
    • All of the information about an assembly available to the compiler at compile time is kept in the Meta Data.
      • This allows assemblies to use classes declared in other assemblies.
      • This information can also be used by the programmer at run time.