Immutability is a cornerstone of robust distributed systems, but achieving it in C# has historically required copious boilerplate. C# 9.0 introduces Records, a first-class citizen for immutable data. Records provide value-based equality, non-destructive mutation, and concise syntax. The Syntax Evolution Value-Based Equality Records check equality by properties, not reference. Non-Destructive Mutation (‘with’ expressions) To modify […]
Read more โCategory: .NET
All .NET Related Stuffs goes here.
Blazor CSS Isolation: Scoped Styles in .NET 5
A preview feature for .NET 5 (arriving Nov 2020) is CSS Isolation. Similar to Vue’s `scoped` styles or React Modules, this prevents style leakage between components. How it Works Create a file matching the component name: `Counter.razor.css`. At build time, Blazor rewrites HTML with a unique attribute `b-123abc` and rewrites CSS: The Deep Combinator To […]
Read more โGraphQL with .NET: Hot Chocolate Library
Hot Chocolate is the premier GraphQL server for .NET. Unlike Rest APIs, GraphQL allows clients to ask for exactly what they need, solving over-fetching. Hot Chocolate 11 brings massive performance improvements and the “Banana Cake Pop” IDE. Schema Definition (Code-First) Handling Relationships (DataLoaders) The “N+1 Problem” is the enemy of GraphQL. Use DataLoaders to batch […]
Read more โBlazor Component Libraries: Building Reusable UI
Razor Class Libraries (RCLs) allow you to share Blazor components across multiple apps. With .NET Core 3.1 and upcoming .NET 5, they now support including static assets (CSS, JS, images) inside the NuGet package. This guide builds a reusable “Modal” component library. Project Structure Create a new RCL project: Static Web Assets Place CSS in […]
Read more โ.NET 5 Preview: What’s Coming This November
.NET 5 unifies .NET Core and .NET Framework. Here’s what to expect when it releases in November. The Unification One .NET going forward C# 9 and F# 5 Single BCL across all platforms Top-level programs Records and init-only setters Performance Significant perf improvements in GC, JIT, and libraries. ARM64 support improved. References .NET 5 Preview
Read more โBuilding Your First Blazor WebAssembly App
Let’s build a complete Blazor WebAssembly application step by step – a task manager with CRUD operations. Project Structure A Simple Component References Blazor Tutorial
Read more โ