Microsoft .NET has evolved significantly since its introduction in 2002. What started as a Windows-focused development platform has transformed into a cross-platform, open-source and high-performance ecosystem used for enterprise applications, cloud services, APIs, desktop software, mobile applications and distributed systems.
Alongside .NET, the C# programming language has also evolved. Every major C# release has introduced new syntax, programming capabilities, keywords, operators and performance improvements.
In this technical guide, we will explore the complete evolution of .NET and C#, covering their versions, release timelines, important features, unique libraries, namespaces, methods, keywords and practical code examples.
Last reviewed: November 2026
1. What Is .NET?
.NET is a free, open-source and cross-platform development platform created by Microsoft. It provides a runtime, programming libraries, compilers, SDKs and development tools for building different types of applications.
Developers can use languages such as C#, F# and Visual Basic to develop applications that run on the .NET platform.
Major Application Types Supported by .NET
- ASP.NET Core Web Applications
- RESTful Web APIs
- Microservices and distributed applications
- Windows Desktop Applications
- Cloud-native applications
- Background Services and Worker Services
- Mobile Applications through .NET MAUI
- Blazor Web Applications
- Console Applications
- Real-time applications using SignalR
Important Components of .NET
| Component | Description |
|---|---|
| CLR | Common Language Runtime executes managed .NET code. |
| CTS | Common Type System defines how types are declared and used. |
| CLS | Common Language Specification defines rules for language interoperability. |
| JIT | Just-In-Time compiler converts Intermediate Language into native machine code. |
| GC | Garbage Collector manages memory and reclaims unused managed objects. |
| BCL | Base Class Library provides common types and functionality. |
| SDK | Software Development Kit provides tools to build and publish applications. |
| NuGet | Package management system for distributing and consuming .NET libraries. |
How Does .NET Execute C# Code?
C# source code is compiled into Intermediate Language (IL). The runtime loads the compiled assembly and executes its instructions through JIT compilation or supported Ahead-of-Time compilation techniques.
C# Source Code
|
v
C# Compiler (Roslyn)
|
v
Intermediate Language (IL)
|
v
.NET Runtime (CLR)
|
v
JIT / Native AOT
|
v
Native Machine Code
|
v
Application Execution
This architecture allows .NET applications to use a common runtime and libraries across supported operating systems and hardware architectures.
2. Understanding the Evolution of .NET
The history of .NET can be divided into three major generations.
| Generation | Versions | Main Characteristics |
|---|---|---|
| .NET Framework | 1.0 to 4.8.1 | Windows-focused application development. |
| .NET Core | 1.0 to 3.1 | Cross-platform, modular and open-source architecture. |
| Modern .NET | 5 to 10 | Unified platform for modern application development. |
Important: .NET Core was not simply a renamed .NET Framework. It introduced a different runtime, deployment model, project system and cross-platform architecture.
Starting with .NET 5, Microsoft adopted the unified .NET naming convention and stopped using the word Core in the platform name.
3. .NET Framework Version History (2002–2019)
.NET Framework was the original Microsoft .NET implementation. It was primarily designed for Windows-based applications and became widely used in enterprise software, desktop applications, ASP.NET websites and Windows services.
3.1 .NET Framework 1.0 (2002)
Major focus: Introduction of the managed .NET ecosystem.
Important Features
- Common Language Runtime (CLR).
- Garbage Collection.
- Managed code execution.
- ASP.NET Web Forms.
- Windows Forms.
- ADO.NET.
- Classes, interfaces, delegates and events.
- Assembly-based deployment.
Important Namespaces and Libraries
SystemSystem.CollectionsSystem.IOSystem.DataSystem.Data.SqlClientSystem.Windows.FormsSystem.Web
Important Classes and Methods
Console.WriteLine()File.ReadAllText()File.WriteAllText()SqlConnection.Open()SqlCommand.ExecuteReader()SqlDataReader.Read()
Example: ADO.NET Database Connectivity
using System.Data.SqlClient;
string connectionString =
"Server=.;Database=HRMS;Trusted_Connection=True;";
using (SqlConnection connection =
new SqlConnection(connectionString))
{
connection.Open();
SqlCommand command = new SqlCommand(
"SELECT EMPLOYEE_NAME FROM EMPLOYEE_MASTER",
connection);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader["EMPLOYEE_NAME"]);
}
}
This example demonstrates the traditional ADO.NET approach to connecting to SQL Server, executing SQL queries and reading database results.
3.2 .NET Framework 1.1 (2003)
Major focus: Improvements to the original framework.
Important Features
- ASP.NET mobile controls.
- Improved security and application configuration.
- ADO.NET improvements.
- Improved support for IPv6.
- Performance and reliability enhancements.
3.3 .NET Framework 2.0 (2005)
Major focus: Generics and type-safe programming.
Important Features
- Generics.
- Nullable value types.
- Anonymous methods.
- Iterators.
- Partial classes.
- Static classes.
- Improved ADO.NET.
- Generic collections.
Important Types
List<T>Dictionary<TKey, TValue>Nullable<T>Nullable<int>System.Collections.Generic
Example: Generics
List<string> employees = new List<string>();
employees.Add("Rahul");
employees.Add("Amit");
employees.Add("Neha");
foreach (string employee in employees)
{
Console.WriteLine(employee);
}
Example: Nullable Value Types
int? managerId = null;
if (managerId.HasValue)
{
Console.WriteLine(managerId.Value);
}
else
{
Console.WriteLine("Manager not assigned");
}
Generics introduced compile-time type safety and reusable collection types. Nullable value types made it possible for value types such as integers to represent missing values.
3.4 .NET Framework 3.0 (2006)
Major focus: Windows application and distributed system technologies.
Important Technologies
- Windows Presentation Foundation (WPF).
- Windows Communication Foundation (WCF).
- Windows Workflow Foundation (WF).
- Windows CardSpace.
Important Namespaces
System.WindowsSystem.ServiceModelSystem.Workflow
Example: WCF Service Contract
using System.ServiceModel;
[ServiceContract]
public interface IEmployeeService
{
[OperationContract]
string GetEmployeeName(int employeeId);
}
WCF provided a framework for service-oriented communication between distributed applications using protocols such as HTTP, TCP and other supported transports.
3.5 .NET Framework 3.5 (2007)
Major focus: LINQ and declarative programming.
Important Features
- Language Integrated Query (LINQ).
- Lambda expressions.
- Extension methods.
- Anonymous types.
- Expression trees.
- Automatic properties.
- Object initializers.
- Collection initializers.
- Entity Framework 1.0 was introduced in this generation.
Important Methods
Where()Select()OrderBy()GroupBy()FirstOrDefault()Any()Count()ToList()
Example: LINQ Query
var employees = new List<Employee>
{
new Employee { Id = 1, Name = "Rahul", Salary = 30000 },
new Employee { Id = 2, Name = "Amit", Salary = 50000 },
new Employee { Id = 3, Name = "Neha", Salary = 60000 }
};
var result = employees
.Where(x => x.Salary > 40000)
.OrderBy(x => x.Name)
.Select(x => x.Name)
.ToList();
Example: Extension Method
public static class StringExtensions
{
public static bool IsValidEmail(this string value)
{
return !string.IsNullOrWhiteSpace(value)
&& value.Contains("@");
}
}
// Usage
bool result = "developer@example.com".IsValidEmail();
LINQ was one of the most important additions in C# and .NET. It introduced a consistent querying approach for in-memory collections, databases and other LINQ-compatible data sources.
3.6 .NET Framework 4.0 (2010)
Major focus: Parallel programming and dynamic capabilities.
Important Features
- Task Parallel Library (TPL).
- Parallel LINQ (PLINQ).
- Dynamic Language Runtime (DLR).
- Dynamic keyword support.
- Code Contracts.
- Managed Extensibility Framework (MEF).
- Improved garbage collection.
Important Classes and Methods
TaskTaskFactoryParallel.For()Parallel.ForEach()Task.WaitAll()Task.ContinueWith()System.Dynamic
Example: Parallel Processing
Parallel.ForEach(employees, employee =>
{
Console.WriteLine(employee.Name);
});
Parallel programming allows suitable independent operations to execute concurrently. It should be used after evaluating CPU workload, shared state and synchronization requirements.
3.7 .NET Framework 4.5 (2012)
Major focus: Asynchronous programming.
Important Features
- Async and await keywords.
- Task-based asynchronous programming improvements.
- ASP.NET Web API.
- ASP.NET MVC 4.
- WebSockets support.
- Improved garbage collection.
- Asynchronous file and network operations.
Important Methods
Task.Run()Task.WhenAll()Task.WhenAny()File.ReadAllTextAsync()HttpClient.GetAsync()
Example: Asynchronous Programming
public async Task<string> GetEmployeeDataAsync()
{
using HttpClient client = new HttpClient();
string response = await client.GetStringAsync(
"https://example.com/api/employees");
return response;
}
Async and await made asynchronous programming easier to understand and maintain, especially for I/O-bound operations such as database queries, file operations and HTTP requests.
3.8 .NET Framework 4.5.1 and 4.5.2 (2013–2014)
Important Improvements
- Improved debugging and profiling.
- Improved application lifecycle management.
- Better ASP.NET deployment capabilities.
- Improved garbage collection.
- Enhanced security and reliability.
3.9 .NET Framework 4.6 (2015)
Important Features
- RyuJIT 64-bit JIT compiler.
- Improved garbage collection.
- SIMD support through System.Numerics.Vectors.
- Improved cryptography APIs.
- ADO.NET improvements.
3.10 .NET Framework 4.6.1 and 4.6.2 (2015–2016)
Important Improvements
- Improved WPF and Windows Forms support.
- Improved networking.
- Better TLS support.
- Improved cryptographic functionality.
- Improved ASP.NET and deployment capabilities.
3.11 .NET Framework 4.7 and 4.7.1 (2017)
Important Features
- High DPI support improvements.
- WPF enhancements.
- Improved touch and accessibility support.
- ValueTuple support in framework libraries.
- Improved cryptography and networking.
3.12 .NET Framework 4.7.2 (2018)
Important Improvements
- Improved security and authentication APIs.
- ADO.NET improvements.
- ASP.NET enhancements.
- Better data protection integration.
3.13 .NET Framework 4.8 (2019)
Major focus: Reliability, security and Windows compatibility.
Important Features
- Improved JIT compiler.
- Improved Windows Forms and WPF.
- High DPI improvements.
- Accessibility improvements.
- Updated cryptographic capabilities.
- Improved networking and security.
3.14 .NET Framework 4.8.1 (2022)
Important Features
- Native ARM64 support on supported Windows systems.
- Accessibility improvements.
- Updated Windows Forms controls.
- Runtime and framework reliability improvements.
.NET Framework 4.8.1 is the final major .NET Framework release. It remains relevant for maintaining existing Windows-based enterprise applications.
4. .NET Core Version History (2016–2019)
.NET Core represented a major change in Microsoft's development strategy. It introduced a cross-platform, modular and open-source implementation of .NET.
4.1 .NET Core 1.0 (2016)
Major focus: Cross-platform development.
Important Features
- Cross-platform execution.
- Linux and macOS support.
- ASP.NET Core.
- Middleware architecture.
- Dependency Injection integration.
- Command-line development tools.
- Modular package architecture.
- Side-by-side runtime deployment.
Important Namespaces
Microsoft.AspNetCoreMicrosoft.Extensions.DependencyInjectionMicrosoft.Extensions.ConfigurationMicrosoft.Extensions.LoggingSystem.Net.Http
Example: ASP.NET Core Middleware
public void Configure(IApplicationBuilder app)
{
app.Use(async (context, next) =>
{
Console.WriteLine("Before Request");
await next();
Console.WriteLine("After Request");
});
app.Run(async context =>
{
await context.Response.WriteAsync("Hello .NET Core");
});
}
4.2 .NET Core 2.0 (2017)
Important Features
- .NET Standard 2.0.
- Expanded API compatibility.
- Improved ASP.NET Core.
- Improved Entity Framework Core.
- Better tooling and development experience.
Example: Dependency Injection
services.AddScoped<IEmployeeService, EmployeeService>();
services.AddTransient<IEmailService, EmailService>();
services.AddSingleton<ICacheService, CacheService>();
The three common dependency injection lifetimes are:
- Transient: A new instance is created each time requested.
- Scoped: One instance is used within a dependency injection scope, normally one HTTP request.
- Singleton: One instance is shared by the service provider.
4.3 .NET Core 2.1 (2018)
Major focus: Performance and memory efficiency.
Important Features
- Span<T>.
- Memory<T>.
- ASP.NET Core SignalR.
- HttpClientFactory.
- Tiered compilation.
- Improved runtime performance.
- Razor Class Libraries.
Important Namespaces and APIs
System.MemorySystem.BuffersMicrosoft.AspNetCore.SignalRIHttpClientFactorySpan<T>Memory<T>
Example: Span<T>
string employeeCode = "EMP-101";
ReadOnlySpan<char> code = employeeCode.AsSpan();
Console.WriteLine(code.Slice(0, 3));
Span and Memory provide efficient ways to work with contiguous memory without requiring unnecessary intermediate allocations.
Example: HttpClientFactory
services.AddHttpClient();
public class EmployeeApiService
{
private readonly HttpClient _client;
public EmployeeApiService(IHttpClientFactory factory)
{
_client = factory.CreateClient();
}
}
4.4 .NET Core 2.2 (2018)
Important Features
- Endpoint Routing.
- Health Checks.
- ASP.NET Core improvements.
- Performance improvements.
- Improved authentication and authorization capabilities.
Example: Health Check
services.AddHealthChecks();
app.UseHealthChecks("/health");
4.5 .NET Core 3.0 (2019)
Major focus: Expanded application development capabilities.
Important Features
- C# 8 support.
- Nullable reference types.
- System.Text.Json.
- Asynchronous streams.
- gRPC support.
- Worker Services.
- Windows Forms support.
- WPF support.
- Improved garbage collection.
Important Libraries
System.Text.JsonSystem.Threading.ChannelsMicrosoft.Extensions.HostingGrpc.AspNetCore
Example: System.Text.Json
using System.Text.Json;
var employee = new
{
EmployeeId = 101,
EmployeeName = "Rahul"
};
string json = JsonSerializer.Serialize(employee);
Console.WriteLine(json);
var result = JsonSerializer.Deserialize<Employee>(json);
Example: Asynchronous Streams
public async IAsyncEnumerable<int> GetEmployeeIdsAsync()
{
for (int i = 1; i <= 5; i++)
{
await Task.Delay(100);
yield return i;
}
}
await foreach (int id in GetEmployeeIdsAsync())
{
Console.WriteLine(id);
}
4.6 .NET Core 3.1 (2019)
Major focus: Long-term support and production stability.
Important Improvements
- Long-term support release.
- ASP.NET Core performance improvements.
- Entity Framework Core improvements.
- System.Text.Json enhancements.
- Better desktop development support.
- Runtime reliability improvements.
.NET Core 3.1 became an important enterprise development platform before the unified .NET 5 release.
5. Modern .NET Version History (2020–2025)
Modern .NET unified the .NET platform under a common product name and continued improving runtime performance, cloud development, developer productivity and application security.
5.1 .NET 5 (2020)
Associated C# version: C# 9
Major focus: Unified .NET platform.
Important Features
- Unified .NET product platform.
- Records.
- Init-only properties.
- Top-level statements.
- Pattern matching improvements.
- Target-typed new expressions.
- Improved runtime performance.
- Improved ARM64 support.
- Native AOT-related groundwork and performance work.
Important C# Keywords and Syntax
recordinitis notandornotnew()
Example: Record Type
public record EmployeeDto(
int EmployeeId,
string EmployeeName,
string Email
);
var employee1 = new EmployeeDto(
101, "Rahul", "rahul@example.com");
var employee2 = new EmployeeDto(
101, "Rahul", "rahul@example.com");
Console.WriteLine(employee1 == employee2);
Records provide value-based equality by default and are useful for data transfer objects and immutable data models.
Example: Init-Only Properties
public class Employee
{
public int EmployeeId { get; init; }
public string EmployeeName { get; init; } = "";
}
var employee = new Employee
{
EmployeeId = 101,
EmployeeName = "Rahul"
};
5.2 .NET 6 (2021)
Associated C# version: C# 10
Major focus: Developer productivity and modern web APIs.
Important Features
- Minimal APIs.
- Hot Reload.
- Global using directives.
- File-scoped namespaces.
- DateOnly and TimeOnly.
- Improved LINQ.
- HTTP/3 support.
- Improved System.Text.Json.
- Performance improvements.
Important Libraries and Namespaces
Microsoft.AspNetCore.BuilderMicrosoft.Extensions.HostingMicrosoft.Extensions.DependencyInjectionSystem.DateOnlySystem.TimeOnlySystem.Linq
Important Methods and APIs
MapGet()MapPost()MapPut()MapDelete()Chunk()DistinctBy()MaxBy()MinBy()
Example: Minimal API
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/api/employees/{id:int}", (int id) =>
{
return Results.Ok(new
{
EmployeeId = id,
EmployeeName = "Rahul"
});
});
app.Run();
Example: Global Using
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using System.Threading.Tasks;
Example: File-Scoped Namespace
namespace HRMS.Models;
public class Employee
{
public int EmployeeId { get; set; }
public string EmployeeName { get; set; } = "";
}
Example: DateOnly and TimeOnly
DateOnly joiningDate = new DateOnly(2026, 11, 3);
TimeOnly officeStart = new TimeOnly(9, 30);
Console.WriteLine(joiningDate);
Console.WriteLine(officeStart);
Example: LINQ DistinctBy and Chunk
var uniqueEmployees = employees
.DistinctBy(x => x.Email)
.ToList();
var employeeChunks = employees.Chunk(100);
5.3 .NET 7 (2022)
Associated C# version: C# 11
Major focus: Runtime performance and application optimization.
Important Features
- Generic Math.
- Required members.
- Raw string literals.
- List patterns.
- Generic attributes.
- Rate Limiting middleware.
- Output Caching middleware.
- Improved Native AOT support.
- On-Stack Replacement (OSR).
- Improved JSON serialization.
Important Namespaces and APIs
System.NumericsSystem.Threading.RateLimitingMicrosoft.AspNetCore.RateLimitingMicrosoft.AspNetCore.OutputCachingRequiredMemberAttribute
Example: Required Members
public class Employee
{
public required int EmployeeId { get; set; }
public required string EmployeeName { get; set; }
public string? Email { get; set; }
}
var employee = new Employee
{
EmployeeId = 101,
EmployeeName = "Rahul"
};
Example: Raw String Literals
string json = """
{
"employeeId": 101,
"employeeName": "Rahul",
"department": "IT"
}
""";
Example: Rate Limiting
builder.Services.AddRateLimiter(options =>
{
options.AddFixedWindowLimiter("api-policy", limiter =>
{
limiter.PermitLimit = 10;
limiter.Window = TimeSpan.FromMinutes(1);
limiter.QueueLimit = 0;
});
});
var app = builder.Build();
app.UseRateLimiter();
app.MapGet("/api/employees", () => "Employee Data")
.RequireRateLimiting("api-policy");
Rate limiting is useful for protecting APIs from excessive traffic. Production systems should generally configure partitioning by an appropriate identity, such as authenticated user, API key or client.
Example: Output Caching
builder.Services.AddOutputCache();
var app = builder.Build();
app.UseOutputCache();
app.MapGet("/api/departments", () =>
{
return new[] { "IT", "HR", "Finance" };
})
.CacheOutput();
5.4 .NET 8 (2023)
Associated C# version: C# 12
Support type: Long-Term Support (LTS).
Major focus: Cloud-native development, performance and developer productivity.
Important Features
- Primary constructors.
- Collection expressions.
- Inline arrays.
- Keyed Dependency Injection.
- TimeProvider abstraction.
- Frozen Collections.
- Native AOT improvements.
- ASP.NET Core Identity API endpoints.
- Blazor improvements.
- Improved JSON serialization.
- Garbage collection improvements.
Important Libraries and Namespaces
System.Collections.FrozenSystem.TimeProviderMicrosoft.Extensions.DependencyInjectionMicrosoft.AspNetCore.IdentitySystem.Text.JsonSystem.Runtime.InteropServices
Example: Primary Constructors
public class EmployeeService(
IEmployeeRepository repository)
{
public async Task<Employee?> GetByIdAsync(int id)
{
return await repository.GetByIdAsync(id);
}
}
Primary constructors reduce constructor boilerplate in classes and structs. They do not automatically generate public properties.
Example: Collection Expressions
List<string> departments =
[
"IT",
"HR",
"Finance"
];
int[] first = [1, 2, 3];
int[] second = [4, 5, 6];
int[] combined = [..first, ..second];
Example: Keyed Dependency Injection
builder.Services.AddKeyedScoped<
IEmailService,
SmtpEmailService>("smtp");
builder.Services.AddKeyedScoped<
IEmailService,
SendGridEmailService>("sendgrid");
Inject a specific implementation:
public class NotificationService(
[FromKeyedServices("sendgrid")]
IEmailService emailService)
{
public Task SendAsync(string message)
{
return emailService.SendAsync(message);
}
}
Example: TimeProvider
builder.Services.AddSingleton(TimeProvider.System);
public class PayrollService(TimeProvider timeProvider)
{
public DateTime GetCurrentUtcTime()
{
return timeProvider.GetUtcNow().UtcDateTime;
}
}
TimeProvider makes date and time dependent logic easier to test using a controlled clock.
Example: Frozen Collections
using System.Collections.Frozen;
var permissions = new[]
{
"EMPLOYEE_VIEW",
"EMPLOYEE_EDIT",
"LEAVE_APPROVE"
};
FrozenSet<string> permissionSet =
permissions.ToFrozenSet();
bool isAllowed =
permissionSet.Contains("EMPLOYEE_VIEW");
Example: Native AOT Publishing
dotnet publish -c Release -r win-x64 /p:PublishAot=true
Native AOT compiles an application into native code during publishing. It can improve startup time and reduce deployment requirements for suitable applications. Reflection-heavy libraries may require additional configuration or changes.
5.5 .NET 9 (2024)
Associated C# version: C# 13
Support type: Standard-Term Support (STS).
Major focus: Runtime optimization, caching and cloud-native applications.
Important Features
- HybridCache.
- Improved LINQ APIs.
- Improved Native AOT.
- Improved JSON serialization.
- Performance improvements.
- Improved garbage collection.
- ASP.NET Core OpenAPI improvements.
- Microsoft.Extensions.AI abstractions.
- Improved cloud-native tooling.
Important Libraries and APIs
Microsoft.Extensions.Caching.HybridHybridCacheCountBy()AggregateBy()Microsoft.Extensions.AISystem.Text.Json
Example: HybridCache
builder.Services.AddHybridCache();
public class DepartmentService(
HybridCache cache,
IDepartmentRepository repository)
{
public async Task<List<Department>> GetDepartmentsAsync(
CancellationToken cancellationToken)
{
return await cache.GetOrCreateAsync(
"departments",
async cancel =>
await repository.GetAllAsync(cancel),
cancellationToken: cancellationToken);
}
}
HybridCache provides a unified caching abstraction with in-process caching and optional distributed cache integration. It is useful for frequently accessed data such as department masters and configuration values.
Example: LINQ CountBy
var departmentCounts = employees
.CountBy(x => x.DepartmentId)
.ToList();
Example: LINQ AggregateBy
var departmentSalaryTotals = employees.AggregateBy(
x => x.DepartmentId,
0m,
(total, employee) => total + employee.Salary
);
Example: C# 13 params Collections
public int Sum(params ReadOnlySpan<int> numbers)
{
int total = 0;
foreach (int number in numbers)
{
total += number;
}
return total;
}
int result = Sum(10, 20, 30);
Example: System.Threading.Lock
private readonly Lock _lock = new();
private int _counter;
public void Increment()
{
lock (_lock)
{
_counter++;
}
}
The dedicated Lock type provides synchronization for multithreaded code. It does not provide distributed locking across multiple application servers.
5.6 .NET 10 (2025)
Associated C# version: C# 14
Support type: Long-Term Support (LTS).
Major focus: Runtime performance, developer productivity, security and modern application development.
Important Features
- C# 14 language improvements.
- Improved JIT compiler and code generation.
- Native AOT improvements.
- Improved JSON serialization.
- Improved ASP.NET Core.
- OpenAPI enhancements.
- Passkey support in ASP.NET Core Identity.
- EF Core 10 improvements.
- Improved testing platform integration.
- Enhanced container development tools.
- Additional cryptography and networking APIs.
Important Libraries and APIs
System.Text.JsonSystem.Net.WebSocketsMicrosoft.AspNetCore.IdentityMicrosoft.AspNetCore.OpenApiMicrosoft.EntityFrameworkCoreSystem.Security.CryptographySystem.Threading.Channels
Example: C# 14 Field-Backed Properties
public class Employee
{
public string EmployeeName
{
get;
set
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException(
"Employee name is required");
}
field = value;
}
} = "";
}
The field keyword provides access to the compiler-generated backing field of an automatically implemented property.
Example: Null-Conditional Assignment
Employee? employee = GetEmployee();
employee?.Department = "IT";
The assignment is performed only when employee is not null.
Example: Extension Blocks
public static class EmployeeExtensions
{
extension(Employee employee)
{
public bool IsEligibleForPromotion
{
get
{
return employee.YearsOfExperience >= 3;
}
}
}
}
C# 14 extension blocks support extension members, including instance and static extension methods and properties.
Example: JSON Serialization Improvements
using System.Text.Json;
var options = new JsonSerializerOptions
{
AllowDuplicateProperties = false
};
string json = JsonSerializer.Serialize(
new
{
EmployeeId = 101,
EmployeeName = "Rahul"
},
options
);
.NET 10 introduces additional JSON serialization options and APIs. For production systems, select strictness settings according to the compatibility requirements of the API.
Example: Native AOT Publishing
dotnet publish -c Release -r linux-x64 /p:PublishAot=true
Native AOT is particularly useful for suitable command-line applications, small services and workloads where startup time and deployment size are important.
6. Important .NET Libraries and Namespaces Every Developer Should Know
Understanding .NET version history is useful, but professional backend development requires knowing the libraries and APIs that solve common engineering problems.
6.1 System
The System namespace contains fundamental types and functionality used in almost every .NET application.
Console- Console input and output.String- String manipulation.DateTime- Date and time handling.DateOnly- Date without time.TimeOnly- Time without date.Guid- Globally unique identifiers.TimeSpan- Time intervals.Environment- Runtime environment information.Convert- Type conversions.Math- Mathematical operations.
6.2 System.Collections.Generic
Provides generic collection types.
List<T>Dictionary<TKey, TValue>HashSet<T>Queue<T>Stack<T>LinkedList<T>SortedSet<T>
Example: Dictionary
Dictionary<int, string> employees = new()
{
{ 101, "Rahul" },
{ 102, "Amit" },
{ 103, "Neha" }
};
if (employees.TryGetValue(101, out string? name))
{
Console.WriteLine(name);
}
6.3 System.Linq
LINQ provides query operations for collections and supported data sources.
Important Methods
Where()Select()SelectMany()Join()GroupJoin()GroupBy()OrderBy()ThenBy()Distinct()DistinctBy()First()FirstOrDefault()Single()Any()All()Count()Sum()Average()ToDictionary()ToLookup()
6.4 System.Threading and System.Threading.Tasks
These namespaces provide threading, asynchronous programming and concurrency functionality.
Important Types and Methods
TaskTask<T>ValueTask<T>CancellationTokenCancellationTokenSourceSemaphoreSlimMonitorInterlockedParallelChannel<T>
Example: CancellationToken
public async Task ProcessEmployeesAsync(
CancellationToken cancellationToken)
{
foreach (var employee in employees)
{
cancellationToken.ThrowIfCancellationRequested();
await ProcessEmployeeAsync(
employee,
cancellationToken);
}
}
6.5 System.IO
Provides file and stream operations.
FileDirectoryPathFileInfoDirectoryInfoFileStreamMemoryStreamStreamReaderStreamWriter
Example: Asynchronous File Reading
string content = await File.ReadAllTextAsync(
"employee-data.json");
Console.WriteLine(content);
6.6 System.Text.Json
Provides JSON serialization and deserialization.
JsonSerializer.Serialize()JsonSerializer.Deserialize()JsonDocument.Parse()JsonElementJsonSerializerOptionsJsonNamingPolicy.CamelCaseJsonIgnoreAttributeJsonPropertyNameAttribute
6.7 System.Net.Http
Used for HTTP communication with external services and APIs.
HttpClientHttpRequestMessageHttpResponseMessageHttpContentHttpClientFactoryGetAsync()PostAsync()SendAsync()ReadAsStringAsync()
6.8 Microsoft.Extensions.DependencyInjection
Provides the dependency injection abstractions and service registration functionality used by modern .NET applications.
AddScoped()AddTransient()AddSingleton()AddKeyedScoped()AddKeyedTransient()AddKeyedSingleton()GetRequiredService()GetService()
6.9 Microsoft.Extensions.Logging
Provides structured logging abstractions.
ILogger<T>ILoggerFactoryLogInformation()LogWarning()LogError()LogCritical()BeginScope()
6.10 Microsoft.Extensions.Configuration
Provides application configuration management.
IConfigurationIConfigurationSectionGetSection()GetValue<T>()GetConnectionString()Bind()
6.11 Microsoft.Extensions.Caching
Provides caching abstractions for frequently accessed data.
IMemoryCacheIDistributedCacheHybridCacheGetOrCreate()GetOrCreateAsync()Set()Remove()
6.12 Entity Framework Core
Entity Framework Core is an object-relational mapper (ORM) for working with relational databases through .NET objects.
Important Classes and Methods
DbContextDbSet<T>SaveChangesAsync()AsNoTracking()Include()ThenInclude()ToListAsync()FirstOrDefaultAsync()ExecuteUpdateAsync()ExecuteDeleteAsync()Database.BeginTransactionAsync()
Example: Entity Framework Core
public class EmployeeDbContext : DbContext
{
public EmployeeDbContext(
DbContextOptions<EmployeeDbContext> options)
: base(options)
{
}
public DbSet<Employee> Employees => Set<Employee>();
}
public async Task<List<Employee>> GetEmployeesAsync(
EmployeeDbContext context)
{
return await context.Employees
.AsNoTracking()
.Where(x => x.IsActive)
.ToListAsync();
}
6.13 Microsoft.Data.SqlClient
Provides SQL Server connectivity using ADO.NET.
SqlConnectionSqlCommandSqlDataReaderSqlTransactionExecuteReaderAsync()ExecuteScalarAsync()ExecuteNonQueryAsync()
6.14 Other Important .NET Ecosystem Libraries
| Library | Purpose | Common Use |
|---|---|---|
| Dapper | Micro ORM | High-performance SQL data access. |
| StackExchange.Redis | Redis client | Distributed caching and data structures. |
| Serilog | Structured logging | Application diagnostics. |
| FluentValidation | Validation library | Request and model validation. |
| AutoMapper | Object mapping | DTO and entity mapping. |
| Polly | Resilience library | Retries, timeouts and circuit breakers. |
| Swashbuckle | OpenAPI tooling | Swagger documentation. |
| MassTransit | Messaging framework | Message-driven applications. |
| Grpc.Net.Client | gRPC client | Service-to-service communication. |
| Azure.Storage.Blobs | Azure storage SDK | File and document storage. |
These are ecosystem packages, not all built-in framework libraries. Their versions and compatibility should be checked independently of the .NET runtime version.
7. Important .NET Methods and APIs: Practical Reference
The following methods are frequently used in enterprise applications and backend development.
| Method / API | Purpose | Example |
|---|---|---|
| Where() | Filters records. | employees.Where(x => x.IsActive) |
| Select() | Projects data. | employees.Select(x => x.Name) |
| SelectMany() | Flattens nested collections. | departments.SelectMany(x => x.Employees) |
| GroupBy() | Groups records. | employees.GroupBy(x => x.DepartmentId) |
| Any() | Checks whether any item matches. | employees.Any() |
| All() | Checks whether all items match. | employees.All(x => x.IsActive) |
| FirstOrDefault() | Returns the first matching item or default. | employees.FirstOrDefault() |
| DistinctBy() | Removes duplicates based on a key. | employees.DistinctBy(x => x.Email) |
| Chunk() | Splits a collection into batches. | employees.Chunk(100) |
| Task.WhenAll() | Asynchronously waits for multiple tasks. | await Task.WhenAll(tasks) |
| CancellationToken | Supports cooperative cancellation. | ThrowIfCancellationRequested() |
| Serialize() | Converts objects to JSON. | JsonSerializer.Serialize(data) |
| Deserialize() | Converts JSON into objects. | JsonSerializer.Deserialize<T>(json) |
| GetOrCreateAsync() | Gets or creates a cached value. | cache.GetOrCreateAsync(...) |
| ExecuteReaderAsync() | Executes a SQL query returning rows. | command.ExecuteReaderAsync() |
Example: Combining Multiple LINQ Methods
var departmentReport = employees
.Where(x => x.IsActive)
.GroupBy(x => x.DepartmentId)
.Select(group => new
{
DepartmentId = group.Key,
EmployeeCount = group.Count(),
AverageSalary = group.Average(x => x.Salary),
TotalSalary = group.Sum(x => x.Salary)
})
.OrderByDescending(x => x.TotalSalary)
.ToList();
This example filters active employees, groups them by department and calculates department-level statistics.
