Introduction: .NET 8 represents a landmark release in Microsoft’s development platform evolution, bringing Native AOT to mainstream scenarios, unifying Blazor’s rendering models, and introducing C# 12’s powerful new features. Released in November 2023, this Long-Term Support version delivers significant performance improvements, reduced memory footprint, and enhanced developer productivity. After migrating several enterprise applications to .NET […]
Read more โCategory: .NET
All .NET Related Stuffs goes here.
.NET 6 Linq Improvements: MaxBy and MinBy
A small but frequent annoyance in LINQ was finding the object with the max value. Previously, we had doing `OrderByDescending(x => x.Val).First()`, which is O(N log N). .NET 6 adds `MaxBy` and `MinBy`. This is O(N) and much more readable. Other additions include `Chunk()` for splitting lists into batches.
Read more โBlazor in .NET 6: Dynamic Components
Blazor now supports rendering components dynamically by type. This is crucial for building CMS-like systems or dashboard widgets where the component to render depends on database configuration. Previously, this required complex Reflection or RenderTreeBuilder logic.
Read more โC# 10: Validating Arguments with CallerArgumentExpression
Validating arguments just got cleaner. C# 10 introduces `[CallerArgumentExpression]`. This allows a method to capture the text of the expression passed to it. Microsoft used this to build the new `ArgumentNullException.ThrowIfNull(name)` helper in .NET 6.
Read more โC# 10: Constant Interpolated Strings
A small but welcome quality of life improvement in C# 10. You can finally use string interpolation for `const` strings, as long as the inputs are also strings. This is fantastic for attributing Controllers or defining consistent routing constants without resorting to `static readonly`.
Read more โTesting .NET 6 Applications: Integration Testing with WebApplicationFactory
Integration testing is the highest value testing you can do. In .NET 6, `WebApplicationFactory` makes it incredibly easy to spin up an in-memory version of your API for testing. Exposing the Program Class With Top-level statements, `Program` is internal. To test it, you need to expose it in `Program.cs`: The Test Setup
Read more โ