What's New in C# in 2025: Overview of Key Changes and Trends
2025 has become a landmark year for the .NET ecosystem. The platform continues to evolve rapidly, and the C# language receives new powerful tools that make code more concise, safe, and performant. Whether you write in C# or are just starting your journey with .NET, it's important to stay up to date with the latest changes. In this article, we will break down the main innovations of C# in 2025, and also show how they are applied in practice.
1. Primary Constructors — Standard for Classes
One of the most anticipated and perhaps most noticeable innovations was the final establishment of primary constructors for classes and structs. Previously, this feature was only available for record types, but now it has become a full-fledged part of the language.
Primary constructors allow you to declare parameters directly in the class header, significantly reducing boilerplate code for dependency injection and property initialization.
public class OrderService(ILogger<OrderService> logger, IDatabase db) : IOrderService{ public async Task<Order> GetOrderAsync(int id) { logger.LogInformation("Fetching order {Id}", id); return await db.Orders.FindAsync(id); }}In 2025, this feature became even more flexible: now primary constructor parameters can be used directly in property initializers and methods without explicitly storing them in fields. The compiler automatically generates private fields, saving the developer from extra boilerplate.
2. New Model for Working with Collections: Collection Expressions and Spread
Working with collections in C# 2025 has become significantly more convenient. The key improvement is the extension of Collection Expressions and the introduction of the Spread operator (..).
Now you can create and combine arrays, lists, and even Span with minimal syntactic noise.
// Creating an array using spreadint[] first = [1, 2, 3];int[] second = [4, 5, 6];int[] combined = [..first, ..second, 7, 8]; // Result: [1,2,3,4,5,6,7,8]
// Creating List<T>List<string> names = ["Alice", "Bob", ..GetExtraNames()];The .. (spread) operator now works not only with arrays but also with any collections implementing IEnumerable<T>. This makes code more declarative and readable, especially when working with APIs or configurations.
3. Semi-space Types and Improved Memory Management
Performance has always been a strong point of C#, and 2025 is no exception. Semi-space types (ref struct with extended capabilities) have been added to the language.
Now ref struct can implement interfaces (under certain conditions) and be used in async methods. This opens the path to creating high-performance, allocation-safe abstractions without compromising readability.
public ref struct FastBuffer{ private Span<byte> _buffer;
public FastBuffer(Span<byte> buffer) { _buffer = buffer; }
public void Write(ReadOnlySpan<byte> data) { data.CopyTo(_buffer); _buffer = _buffer.Slice(data.Length); }}
// Usage in async context (new in 2025)public async ValueTask ProcessAsync(FastBuffer buffer){ // Now ref struct can be passed to an async method buffer.Write("Hello"u8); await Task.Delay(1);}Additionally, .NET 9 (the base platform for 2025) introduces new optimizations for PGO (Profile Guided Optimization) and improved support for AVX-512 instructions, providing a significant performance boost in numerical computations.