For 20 years, every C# console application started with the same ceremony: namespace, class Program, static void Main(string[] args). C# 9.0 and .NET 5 change this with Top-level programs. The Change Here is the “Hello World” of the past: Here is C# 9: How It Works The compiler essentially wraps your top-level code into a […]
Read more โCategory: .NET
All .NET Related Stuffs goes here.
Source Generators in C# 9: Compile-Time Code Generation
Metaprogramming in C# has historically relied on reflection (slow at runtime) or T4 templates (clunky build integration). C# 9 changes the game with Source Generators. They allow you to hook into the compilation process, inspect your code, and generate new C# files on the fly that get compiled with your project. How It Works Example: […]
Read more โ.NET 5: Performance Improvements Deep Dive
.NET 5 is the fastest .NET version ever releases. The engineering team has gone through the runtime and libraries with a fine-toothed comb, optimizing everything from the impacts of the Garbage Collector (GC) to the internals of List<T>. Let’s look at the numbers. TechEmpower Benchmarks In the TechEmpower benchmarks (Round 19/20), .NET 5 performs exceptionally […]
Read more โ.NET 5 is Here: The Complete Migration Guide
The wait is over. .NET 5 has officially been released, marking the beginning of the unified .NET platform. This isn’t just another version update; it’s the convergence of .NET Core and .NET Framework into a single, cohesive platform. If you’re running .NET Core 3.1, the upgrade path is straightforward, but substantial. The Vision: One .NET […]
Read more โgRPC-Web: Bringing gRPC to Browser Applications
gRPC-Web enables browser clients to call gRPC services. This is particularly exciting for Blazor WebAssembly, where you can now use the same strongly-typed gRPC contracts on both server and client. Let’s explore how to set this up with .NET 5. Why gRPC-Web? Standard gRPC requires HTTP/2 with trailers, which browsers don’t fully support. gRPC-Web overcomes […]
Read more โC# 9.0 Init-Only Setters: Immutable Object Initialization
Init-only setters in C# 9 solve an age-old problem: how do you create immutable objects while still using the convenient object initializer syntax? Previously, you had to choose between constructor-based initialization (verbose) or public setters (mutable). Init-only setters give you both convenience and immutability. The Problem The Solution: Init-Only Setters Init in Derived Classes Init-only […]
Read more โ