Wednesday 3 October 2012

What is .NET Framework

The .NET Framework ("dot net") is a platform created by Microsoft used to develop different kinds of applications targeted mainly to the Windows operating system. The .NET Framework can also be used for developing web applications. Several versions of the .NET have been released in the past and each iteration adds considerable amount of features to the earlier version. Although .NET applications are designed for Windows, some third-party companies try to port the .NET to other systems. The .NET Framework contains the  .NET Framework Class Library (FCL) which is a gigantic library of classes, structs, enumerations, basic types, and many more which are categorized into different modules or assemblies.
Common Language Runtime (CLR) is the core of .NET which runs .NET applications. It enables the .NET framework to understand a number of supported languages such as C#, Visual Basic, and C++. The code that runs under the CLR and .NET is called managed code because the CLR manages different aspects of your application during runtime.
During compilation, source codes are compiled into Common Intermediate Language (CIL) which is closely identical to assembly language. We have to convert our source code into CIL because it is the only language that can be understood by .NET. For example, codes in C# and Visual Basic both compile to CIL. That is why different .NET applications written in different languages can still communicate to each other. If you want a language to be .NET-compatible, you can create a compiler that compiles your code into the Intermediate Language. The compiled CIL is stored in an assembly such as a .exe or .dll file.
Once your code is compiled to Common Intermediate Language, the job is transfered to the Just-In-Time (JIT) compiler. The JIT compiles the CIL code into native code(the language of computers) only when that part of code is needed by the program (hence the term "just in time"). The compiled native code is automatically optimized for the current OS or machine. This is one advantage of using .NET.
The following summarizes how your C# code is transformed into a machine executable program.
  1. The programmer writes a program in a .NET compatible language such as C#.
  2. The C# code is compiled into its CIL equivalent code.
  3. The CIL is stored in an assembly.
  4. When the code is executed, the JIT compiles the CIL code to native code that the computer can execute.
The .NET Framework also has a feature called the Common Type System (CTS). This is the mapping of the data types specific to a language to its equivalent type in the .NET Framework. Data types are representations of data. For example, whole numbers are represented by the integer data type. With CTS, the int data type in C# and the Integer data type in Visual Basic are the same because both are mapped to the .NET type System.Int32.
Garbage collection is another feature of the .NET Framework. When resources are no longer in use, .NET Framework frees up the memory used by an application. The garbage collector is called whenever it is needed by an application although you can call GC manually to clean up resources for you.
To be able to run a .NET application, you must first install it in your computer. Latest release of Windows 7 operating system has .NET pre-installed. If your system doesn't have .NET installed yet, you can download it by clicking the link below:
Microsoft .NET 4.0 Download
After downloading, run the installer and follow the instructions. You might need to restart the computer after/during installation.
(.NET 4 will also be installed if you install Visual C# Express or Visual Studio 2010 as we will see later).

2 comments:

  1. I love this blog . This is one of the best blog i ever seen. It's all about what i'm searching for. I love to read this blog again and again . Every time i enter this blog i get something new. This blog inspire me to write new blog. I write a blog name SQL learning site. It's about sql,c#,net etc

    ReplyDelete
  2. The blog writings were so nice, I wished they neever ended.
    python isdir

    ReplyDelete