Introduction to .NET Framework

Divya Stephen
5 min readSep 5, 2023

--

.NET Framework is a software development framework for building and running applications on Windows. It is designed and developed by Microsoft and the first beta version released in 2000.

Architecture of .NET Framework

The two major components of .NET Framework are the Common Language Runtime (CLR) and the .NET Framework Class Library (FCL).

CLR manages the execution of .NET programs and Class Library is the collection of classes, namespaces, interfaces and value types that are used for .NET applications. It contains thousands of classes that supports the various functions.

Common Language Runtime (CLR)

CLR is the heart of the .NET Framework

The Common Language Runtime (CLR) is the execution engine that handles running applications. It converts the program into native code (machine code). It provides services like thread management, memory management, garbage collection, type-safety, exception handling, and more.

The code that is developed & controlled using the .NET Framework is called Managed Code, Example: C#, VB.NET, and Unmanaged Code is developed outside of the .NET Framework, Example: C, C++.

.NET Framework Class Library (FCL)

The Class Library provides a set of APIs and types for common functionality. It provides types for strings, dates, numbers, etc. The Class Library includes APIs for reading and writing files, connecting to databases, drawing, and more.

Here, you will be thinking, “I have heard of BCL, does the FCL and BCL are same ?”

BCL, Base Class Library is a core class library and it is the subset of FCL which have some advance class libraries for building different types of software applications, whether they are web-based (ASP.NET), desktop applications (WinForms), involve working with data (ADO.NET), or deal with XML data. It simplifies the development process by providing pre-built functions and components for common tasks in software development.

CTS vs CLS

CLS and CTS both are part of CLR and allow in . NET language cross language communication and type safety. It defines rules that every language must follow which runs under . NET framework.

Common Type System (CTS)

In the .NET Framework, various programming languages like C#, VB.NET, J#, and F# have their own unique data types. These data types are specific to each language and can’t be directly understood by other languages. However, there are situations where we need to make these languages communicate with each other.

For instance, you might want to write code in VB.NET and have it called from C#. To enable smooth communication between these languages, they need to share a Common Type System (CTS). This ensures that data types defined in different languages can be compiled into a common data type.

In the .NET Framework, the Common Language Runtime (CLR) is responsible for executing code from various programming languages. The key to this interoperability is that the CLR has its own set of data types that are consistent across all supported languages. During compilation, the language-specific data types are converted into the CLR’s data types. This data type system shared by all .NET-supported languages is known as the Common Type System (CTS). It allows different languages to work together seamlessly within the .NET ecosystem.

Common Language Speciation (CLS)

In the .NET Framework, CLS (Common Language Specification) is a crucial part of the Common Language Runtime (CLR). Since the .NET Framework supports multiple programming languages, each language has its own unique rules for writing code, known as a language specification. These rules are specific to each language and can’t be directly understood by other languages.

However, there are situations where we need to make different programming languages communicate with each other within the .NET ecosystem. To ensure smooth communication between these languages, they must adhere to a Common Language Specification (CLS). The CLS ensures that the language specifications defined in two different languages can be compiled into a common format.

The CLR in the .NET Framework is responsible for executing code from various programming languages. It can do this because it has its own set of language specifications (syntactical rules) that are consistent across all .NET-supported languages. During compilation, each language’s compiler follows the CLR’s language specification and generates code in a common format called IL (Intermediate Language). This common language specification of the CLR is known as the Common Language Specification (CLS), and it enables different programming languages to work together seamlessly in the .NET environment.

Working Flow

.NET applications can be written in languages like C#, F#, or Visual Basic. When you write code in these languages, it’s not directly turned into machine code. Instead, it’s compiled into something called Common Intermediate Language (CIL or IL).

This CIL code is stored in files with a .dll or .exe extension, which are known as assemblies.

When you run a .NET application, a component called the Common Language Runtime (CLR) steps in. It takes the CIL code from the assemblies and uses a special compiler called the just-in-time compiler (JIT) to turn it into machine code. This machine code is specific to the computer’s architecture and can be executed by the computer.

In simple terms, .NET code is first compiled into a kind of universal code (CIL), and then, when you run the program, the CLR converts it into the actual machine code your computer can understand and execute. This process allows .NET applications to run on different types of computers without needing to rewrite the code for each one.

NOTE: CIL (Common Intermediate Language) was originally known as Microsoft Intermediate Language (MSIL) or Intermediate Language (IL) during the beta releases of the . NET languages. Due to standardization of C# and the CLI, the bytecode is now officially known as CIL, So CIL, MSIL, and IL all are the same ;)

There will be a confusion, when you start working with .NET Framework, the one thing you need to clarify is the difference between .NET and ASP.NET. ASP stands for Active Server Pages and .NET stands for Network Enabled Technology.

So, the .NET is a software framework that allows developing, running, and executing applications while ASP.NET is a web framework ( a tool) that is a part of . NET that allows building dynamic web applications.

We also have the advanced version of .NET Framework, which is the .NET Core.

--

--