GoogleTag

Google Search

Architecture of .NET

The architecture of .NET (referred to as .NET Core or simply .NET from version 5.0 onwards) is a cross-platform, high-performance framework developed by Microsoft. It allows developers to create various types of applications like web, desktop, mobile, gaming, cloud, IoT, and AI.
Here's an overview of the .NET architecture:

1. Common Language Runtime (CLR)

  • The Common Language Runtime is the core execution engine of .NET. It manages the execution of programs written in any .NET-supported language.

  • Key Responsibilities of CLR:

    • Memory management (automatic garbage collection)

    • Thread management

    • Exception handling

    • Code safety (verifying type safety)

    • JIT compilation (Just-in-Time compilation of intermediate code to machine code)

2. Base Class Library (BCL)

  • The Base Class Library is a collection of reusable classes, interfaces, and value types. It provides access to system functionalities such as file reading, database interaction, network communication, and more.

  • It offers fundamental functionalities like:

    • Collections (e.g., List, Dictionary)

    • File I/O (Input/Output)

    • String manipulation

    • XML processing

    • Networking

3. Intermediate Language (IL)

  • When you compile code in .NET, it is converted into an intermediate language called CIL (Common Intermediate Language) or just IL.

  • The compiled IL is platform-agnostic and is JIT compiled into native machine code when executed on the target platform.

4. Just-In-Time (JIT) Compiler

  • The JIT compiler is responsible for converting IL code into native machine code specific to the operating system and CPU architecture.

  • There are different kinds of JIT compilers (e.g., Full JIT, Pre-JIT, and Econo-JIT) depending on the scenario to optimize performance.

5. Languages

  • .NET supports multiple programming languages such as:

    • C#

    • F#

    • Visual Basic (VB.NET)

    • These languages are supported by the CLR and share the same BCL.

6. ASP.NET Core

  • ASP.NET Core is the web application framework built on top of .NET. It provides the infrastructure to build scalable and high-performance web applications and services.

  • It supports both MVC (Model-View-Controller) and Web API frameworks for building web apps and APIs.

7. Entity Framework (EF) Core

  • Entity Framework Core is an Object-Relational Mapping (ORM) framework that allows developers to interact with databases using .NET objects, providing a strongly-typed API.

  • It abstracts away the need for writing SQL queries and makes database interaction more intuitive.

8. Cross-Platform Compatibility

  • Modern .NET (starting from .NET Core) is cross-platform, meaning it can run on Windows, macOS, and Linux. This is a significant evolution from the earlier .NET Framework, which was Windows-specific.

  • Platform-agnostic runtimes:

    • CoreCLR: The runtime for .NET on Windows and Linux.

    • Mono: The runtime used on mobile platforms like iOS, Android, and for games (via Unity).

9. Application Models

.NET supports a wide variety of application models:

  • Desktop Applications: Windows Forms, WPF (Windows Presentation Foundation), and Universal Windows Platform (UWP).

  • Web Applications: ASP.NET Core for web apps and services.

  • Cloud Applications: .NET is widely used to develop scalable and reliable cloud-based applications (supported on Azure).

  • Mobile Applications: With Xamarin/.NET MAUI, developers can build native apps for iOS, Android, and macOS using C# and .NET.

  • Console Applications: Simple command-line apps using the full power of .NET.

  • Games: Through Mono and Unity, .NET is also used in game development.

10. NuGet Package Manager

  • NuGet is the package manager for .NET. It allows developers to share and reuse code libraries easily.

  • Developers can pull in third-party libraries or distribute their own libraries as NuGet packages.

11. Runtime Configurations

.NET can run in various runtime environments:

  • .NET Runtime: For general-purpose applications.

  • ASP.NET Core Runtime: Specifically optimized for web applications.

  • Mono Runtime: A lightweight runtime used for mobile and game development.

12. Garbage Collection (GC) in .Net

  • .NET uses an automatic garbage collection system to manage memory. It periodically cleans up unused objects from memory, reducing the risk of memory leaks.

13. Security

  • .NET has built-in security features, including code access security, role-based security, encryption, and cryptographic algorithms for secure data transmission and storage.

14. Development Tools

  • Developers typically use Visual Studio or Visual Studio Code for developing .NET applications. Both provide debugging, IntelliSense, and project management capabilities.

Diagram of .NET Architecture:

Here’s a high-level summary in a conceptual diagram:


Architecture of .NET


This architecture enables developers to build applications for different platforms using a consistent and unified framework.


.Net Tutorials
(image taken from wiki)

Featured Posts

SQL Interview Questions Topics

 SQL Topics to prepare for interviews,   SQL Basics: Introduction to SQL SQL Data Types DDL (Data Definition Language): C...

Popular Posts