.NET 6 Blazor introduces “, allowing you to render a component whose type is selected at runtime. No more massive switch statements in render trees. Usage Use Cases Plugin systems where component types are registered dynamically. Dashboard builders with user-selectable widgets. Key Takeaways Combine with `System.Reflection` to load components by name. Parameters must be passed […]
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…
C# 10: Validating Arguments with CallerArgumentExpression
Writing guard clauses like `ArgumentNullException.ThrowIfNull(value)` is great, but error messages often lack context. CallerArgumentExpression captures the expression text at compile time. Example Key Takeaways Zero runtime overhead—it’s a compile-time feature. Use in custom assertion libraries or fluent validation.
Read more →C# 10: Constant Interpolated Strings
Prior to C# 10, you couldn’t use string interpolation (`$”…”`) in `const` declarations. Now you can, as long as all parts are also constants. Example Use Case Useful for defining attribute strings cleanly. Key Takeaways Components must be `const`; no runtime expressions allowed. Good for reducing magic strings.
Read more →Testing .NET 6 Applications: Integration Testing with WebApplicationFactory
Unit tests are not enough. Integration tests verify your app works end-to-end, including middleware, dependency injection, and database logic. `WebApplicationFactory` spins up an in-memory test host. Setup Customizing Services Replace the real database with an in-memory one. Key Takeaways Use **Testcontainers** (covered earlier) for real SQL testing. Check HTTP status codes, response bodies, and headers.
Read more →Designing for Nullability in C#
With Nullable Reference Types (NRTs) enabled by default in .NET 6 templates, designing APIs that clearly communicate nullability is no longer optional—it’s expected. Enabling NRTs Guard Clauses Use the new .NET 6 helper to throw if null. Key Takeaways Use `string?` to explicitly mark nullable strings. Use `!` (null-forgiving operator) sparingly—only when you truly know […]
Read more →.NET 6: Minimal APIs Explained
Minimal APIs are the biggest shift in ASP.NET Core since version 1.0. They remove the MVC ceremony (Controllers, Actions, Filters) in favor of a fluent lambda-based syntax. The Code Is it just for tiny apps? No. Performance is technically better than MVC (fewer allocations, no Filter Pipeline overhead). However, organization becomes the challenge. You don’t […]
Read more →