C# 11 Preview: Raw String Literals

Embedding JSON, XML, or SQL in C# has always been painful (escaping quotes). Raw String Literals fix this. The number of ” characters is variable (minimum 3). The content is exactly what…

1 min read

C# 10 Record Structs: Optimization

C# 9 Records were reference types (classes). C# 10 introduces `record struct`, bringing immutability features to value types, eliminating heap allocations for small DTOs. Syntax Performance Benefit Since it’s a struct, `Point`…

C# 10: File-Scoped Namespaces

Vertical whitespace is valuable. The “block-scoped” namespace syntax indents every single class in your project, wasting 4 spaces of indentation. C# 10 introduces File-Scoped namespaces to reclaim that space. Comparison Key Takeaways…

C# 10 Preview: Global Usings

C# 10 (coming with .NET 6) aims to reduce file clutter. **Global Usings** allow you to define namespace imports once for the entire project. Manual Creation Create a file `GlobalUsings.cs`: Implicit Usings…

High Performance C#: Span and Memory

`Span<T>` allows you to work with contiguous memory regions (Arrays, Stack, Native Heap) without allocating new objects. It’s the secret sauce behind Kestrel’s speed. Slicing without Allocation Stackalloc Allocate memory on the…

C# 9.0 Deep Dive: Records, Init-Only, and Patterns

C# 9.0 is arguably the most significant update to the language since LINQ in C# 3.0. It introduces a functional paradigm shift with Records, cementing immutability as a first-class citizen. In this…

1 min read

C# 8.0: Nullable Reference Types in Practice

The “Billion Dollar Mistake” – the null reference – is finally being addressed in C# 8.0. Nullable Reference Types (NRT) are not just a compiler check; they are a fundamental shift in…

1 min read

Extensions Methods in C#

Extensions Methods in C# Extension method is new to C# 3.0 (.NET 3.5).Its allow you to add new method to the existing class. a. Extension method allows you to add new method…

All2 min read

C# Tricks – Evaluate “1”+2+4 and 2+5+”8″

What does “1”+2+4  evaluate to? Wait! Wait! do not get in to conclusion that’s it’s an aptitude, number series question. It actually a question about the result of this operation, if you…

All1 min read

Abstract vs Interface (C#): A Simple Tabular Index

I found that lots of people our there are confused between abstract and interface, including me :-). So i formulated this simple table which list most of the differences between them. Index…

All1 min read