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: Microsoft
Microsoft Corporation (NASDAQ: MSFT) is an American multinational corporation headquartered in Redmond, Washington, United States that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions. Established on April 4, 1975 to develop and sell BASIC interpreters for the Altair 8800, Microsoft rose to dominate the home computer operating system market with MS-DOS in the mid-1980s, followed by the Microsoft Windows line of operating systems.
Microsoft would also come to dominate the office suite market with Microsoft Office. The company has diversified in recent years into the video game industry with the Xbox and its successor, the Xbox 360 as well as into the consumer electronics and digital services market with Zune, MSN and the Windows Phone OS. The ensuing rise of stock in the company’s 1986 initial public offering (IPO) made an estimated three billionaires and 12,000 millionaires…
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 →