What is .NET
Published: 2023-01-02 10:24:41

Have you been confused about what is .NET? Have you once thought is a programming language? I was once confused just like you but this article will help you understand what .NET is clearly.

**What is . NET?**

.NET is a platform for developing applications, it supports multiple languages(C#, F#, VB, etc.), libraries, and Common Language runtime (CLR) for executing the code.
.NET is a free and open-source product by Microsoft.

**What Programming Languages are Supported by .NET**

.NET supports 60 plus programming languages whereby 11 are owned by Microsoft and the remaining by the community. some of the popular languages in the .NET platform include C#, F#, and VB.NET among others.

**.NET Platforms**

There are three different ways to implement the .NET Platform:

1. .NET Core
.NET Core is an open-source and cross-platform .NET Platform for running applications on Linux, Windows OS, and macOS

2. .NET Framework
.NET Framework is used for running windows applications only and does not support other operating systems. This platform is not open-source, the source code is available but does not take direct contribution from the community.

3. Mono/ Xamarin
Xamarin or mono is used to run applications on mobile operating systems such as IOS and Android.

To check on the latest Version visit this [link](https://versionsof.net/)

**What Application can be Build using .NET**

- Web: ASP.NET Core MVC, Web API, Razor Pages, and Microservices
- Mobile
- Console
- Desktop Applications (Starting from 3.0)
- IoT
- ML
- Gaming Applications
- Cloud Applications

**Development Tools**

To develop .NET application we can use any of these tools:

- [Visual Studio](https://visualstudio.microsoft.com/) (heavy-weight)
- [Visual Studio Code ] (https://code.visualstudio.com/)(light-weight)
- Command Line Interface


**COMPILATION AND EXECUTION **

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vy65ecnp60ktp8o5r21.jpg)
The Diagram above shows the process of compiling .NET source code.

The source code written in any language supported by .NET is first compiled into an intermediate language known as Microsoft Intermediate language(MSIL) using the language's respective compiler.

The intermediate code is not however machine code yet so it can't be executed. The code is further compiled into Native code (Code specific to an operating system ) and executed by the machine. The conversion of the MSIL code to Native code is done by the Common Language Runtime (CLR ) component known as the Just-in-time Compiler(JIT).

**.NET COMPONENTS**
The two major components of the .NET Framework are the Common Language Runtime (CLR) and the .NET Framework Class Library/Base class Library.(BCL)
(Check the previous Diagram )

**CLR**
 The Common Language Runtime (CLR) is the execution engine that handles running applications. 

CLR  Consist of a JIT compiler which is responsible for executing the Intermediate Code into Byte Code.

The garbage collector manages the allocation and release of memory for an application. Therefore, developers working with managed code don't have to write code to perform memory management tasks. Automatic memory management can eliminate common problems such as forgetting to free an object and causing a memory leak or attempting to access freed memory for an object that's already been freed.

The Common Language Runtime (CLR) also has a Common Language Interface (CLI). CLI is a specification developed by Microsoft that describes the executable code and runtime environment. In simple terms this allows us to use various high-level programming languages on various machines without rewriting the code. CLI consists of Common type system (CTS)- the CTS is used to make sure that the data types for every language match the defined data types, Common Language Specification (CLS)- is a set of syntax rules that has to be followed for a language to be .NET compliant. among others.

The CLR also provides services like thread management,  type safety, exception handling, and more.

**BCL**
The Base 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.