You might have heard the word .NET floating around in the tech environment. Well, the Dot Net Framework, built by Microsoft, is a competitive development platform that enables you to create and maintain high-performance websites while also providing excellent security features. It offers multiple language support and enables cross-language integration as well.
Many software professionals in Bespoke software development companies choose it as their first choice since it allows them to create applications as per their client’s desires.
Page Contents
What is .NET used for?
.NET framework can be used to create both types of applications: Form-Based applications and Web-Based applications. The best part is you can develop them using diverse set of languages like C++, C#, VB, F#, etc. supported by .NET Framework.
Moreover, it allows you to create windows applications, Web applications, Web services, and a lot more.
What is Cross-language integration?
Cross-language integration means you can use the functionality of language in another language. Very less platforms provide such feature which makes this platform different in the crowd.
The architecture of DotNet framework
DotNet Architecture figure
Difference between Windows Form and Web Form
Windows Form is a Graphical User Interface (GUI) class library of the .NET framework for providing an easier user interface to develop applications for desktop, tablets, PCs. Windows Forms can also be called as WinForms.
While web forms are pages that are a combination of HTML, client-script, server controls, and server codes that users request while using their browser.
What is a Console Application?
To understand it simply, it is an application that takes input from the user and displays output through a command line console.
.NET Framework Base Class Library (BCL)
.NET Framework Base Class Library (BCL) is a sub-part of the .NET Framework. It provides library support to Common Language Runtime (CLR) for working perfectly. It is a library of classes, interfaces, namespaces, and value types that are used in the .NET applications.
Base Class Library Figure
Common Language Runtime (CLR) overview
Common Language Runtime is a virtual machine component of the DotNet framework. CLR provides an environment to run all .NET programs. It is the in charge of controlling the execution of .NET programs, independent of the programming language used.
CLR Architecture figure
What is a Common Type System (CTS)?
CTS is a set of standards. It defines how types are declared, used, and managed in CLR that MISL can understand.
For example, Common Type Systems defines int32 as an integer data type of 32 bits which is mapped by C# through int and VB.NET through its int data type.
Common Language Specification (CLS)
Common Language Specification is a subset of Common Type Systems which means all of the rules in Common Type Systems also apply to Common Language Specification. CLS is a collection of properties that are needed by many common applications.
Microsoft Intermediate language (MSIL)
- What is a CIL (Common intermediate language)?
Microsoft Intermediate language (MSIL) is also known as Common Intermediate Language (CIL). MSIL is a language-independent code.
- Purpose of Microsoft Intermediate Language
When we compile our program using any .NET compliant language, it does not directly convert into binary code but converts into an intermediate code called MSIL. The MSIL code is not dependent on any operating system or language. Just-In-Time (JIT) compiler converts MSIL code to native code for a specific machine or OS.
What is Native code?
Native code is that code that is compiled to run with the specific processor and set of instructions.
- Just-In-Time (JIT) compiler:
Just-In-Time (JIT) compiler converts MSIL code to native code for a specific machine or OS. Only at this point, OS can execute the application.
As the name reflects Just-In-Time, MSIL code is only compiled as, and when, it is needed.
Type of JIT compiler:
- Pre-JIT: Pre-JIT converts all code to executable code. It is a slow compiler.
- Econo JIT: Econo JIT converts called code to executable code. And it converts code every time when code is called.
- Normal JIT: Normal JIT converts called code to executable code and stores it in the cache, so not required to convert code again. It is a fast compiler.
Code Management in .NET
For execution, the code manager calls the class loader.
.NET supports 2 kinds of coding:
- Managed Code
- Unmanaged code
Managed Code:
- Managed code is that code whose execution is managed by the runtime.
- It runs under the Common Language Runtime (CLR) and cannot be called or cannot be accessed outside the runtime environment.
- The code which is developed in .NET is called managed code. Any language that is written in the .NET framework is also a managed code.
- It provides services like garbage collection, runtime type checking, reference checking, etc.
- Examples of managed code are C#, F#, Visual Basic, etc.
Unmanaged Code:
Code that is not managed by runtime or applications that don’t run under Common Language Runtime (CLR) is called unmanaged code.
It is compiled directly to machine code and executed by the Operating System. If you want to run the same code on a different architecture, you have to recompile that code on that architecture.
All code compiled with C / C++ compiler is unmanaged code. Unmanaged code can be unmanaged compiled code or unmanaged source code. Wrapper classes are used to run unmanaged code. There are 2 types of wrapper classes:
- COM callable wrapper (CCW)
- Runtime Callable Wrapper (RCW)
Examples of unmanaged code are VB, ASP, COM, etc.
Garbage Collector (GC):
One of the most important features of managed code is garbage collection.
- Purpose of Garbage Collector
The Garbage collector automatically releases memory space that has been reserved for things that the program no longer requires.
- Benefits of Automatic Memory Management
Automatic memory management may solve problems such as forgetting to free an object, resulting in a memory leak, or trying to access memory for an object that has already been freed.
- How does Garbage Collector work?
The GC.Collect method is used for garbage collection, we don’t have to call that method for garbage collection, it runs continuously. But GC.Collect is primarily used in unique situations or testing.
Class Loader
Class Loader is hold accountability for loading a class after checking the metadata. It only executes the class if the resources are available on the client computer and the dll’s Version and Security Token match those in the metadata.
Conclusion
To conclude this blog, the .NET framework is a very robust and reliable framework that is still widely used all around the world. I think .NET will stay relevant for a long period of time due to its being cross-language integration and reliability. Thus, this was a brief introduction to DotNet Framework Architecture. I hope this sheds some light on the basics of .NET framework architecture.
Author Bio: Kapil Panchal – Technical Content Manager
A passionate Technical writer and an SEO freak working as a Technical content manager in a reputed PowerPoint Add-in development company. Having served in the Information technology, Services, and Product industry for years, I relish writing about technology and love sharing impeccable insights on various platforms. I believe in constant learning and am passionate about being better every day.