Topic / 13 pieces

C# articles

The language itself. Pattern matching, nullable reference types, records, and the features people skip because the old way still compiles.

C# articles

Newest first. No clever sorting hiding the good stuff.

Article / csharp

Stop sprinkling async on everything in ASP.NET Core

Async is amazing for IO bound work in ASP.NET Core, but it is not a seasoning you add to every method. This post breaks down a simple model for deciding when to await and when to stay synchronous. You will see small, runnable examples with minimal APIs, EF Core and background services. We will also cover why Task.Run in controllers rarely helps and when a background queue makes more sense.

4 min0 likes
Article / csharp

Yield return vs return in C#: when to stream and when to deliver

Developers often treat return and yield return like twins, but they behave very differently. This guide explains the mental model behind each, why iterators are lazy, and how the compiler turns them into state machines. You will see small, runnable C# examples that highlight memory and performance tradeoffs. We also cover async iterators with IAsyncEnumerable and await foreach. Learn when to ship a crate of data and when to stream plates one by one.

4 min1 like
Article / csharp

Measure Twice Allocate Once: Faster Lists in .NET

Lists grow by reallocating and copying, which adds hidden cost as data scales. This post shows why setting List capacity up front reduces allocations and improves cache behavior. You will see small runnable examples and practical patterns you can drop into production.

4 min1 like
Article / csharp

Virtual vs Override vs Partial in C# Explained with Small Runnable Examples

Virtual, override and partial are tiny C# keywords with huge impact on design. This post explains how they work, when to use them, and where bugs appear. Learn the difference between override and new, why sealed override matters, and how partial classes and partial methods keep generated and hand written code happy. Every section comes with short, runnable snippets and real project tips.

4 min1 like
Article / csharp

Sealed by Default in .NET: when it Shines and when it Bites

Sealed looks like a tiny keyword, but it carries serious weight in modern .NET. This post explains what sealed does at class and member level, why the JIT can make sealed code faster, when you should not seal, and how to keep code testable with interfaces. You will see small, runnable examples and practical patterns that balance performance, clarity, and flexibility.

5 min0 likes
Article / csharp

Smarter Error Handling in C#: Try, Result and Fewer Tears

Exceptions are powerful for diagnostics but expensive in tight loops and high traffic code. This post explains what the runtime does when you throw, why that cost adds up, and when exceptions are the right tool. You will see small, runnable C# examples that model expected failures with Try, Result and tuples, plus a minimal API that returns HTTP results without throwing. We will also cover a micro tip for library authors to keep fast paths fast.

5 min0 likes
Article / csharp

Stop Parallelizing Everything: A Practical Guide to Parallel.ForEach

Parallel.ForEach feels like a free speed boost, until it slows your app to a crawl. This post explains when parallel loops shine, when they backfire, and how to avoid the classic traps. You will see small runnable C# examples for CPU bound work, shared state pitfalls, and I/O scenarios. We will also cover safer async alternatives, thread local aggregation, and simple tuning with ParallelOptions. By the end, you will know how to pick the right approach and measure the impact with confidence.

4 min0 likes
Article / csharp

The Traps of Nullable<T> in C#: a Practical Guide with Tiny Examples

Nullable<T> is not a mini reference type and pretending it is will bite you. This guide walks through how nullable value types work at runtime, how boxing really behaves, and what operator lifting does. You will see small, runnable C# snippets that expose common traps and safe patterns. Learn how to handle equality, pattern matching, and generics without surprises.

5 min0 likes
Article / csharp

Stop Guessing Types in C#: typeof, GetType and IsAssignableFrom Explained

Let's break down the real jobs of typeof, object.GetType and Type.IsAssignableFrom with small, runnable examples and a few nerdy references for fun.

4 min0 likes
Article / csharp

C# 14's Unbound Generics in nameof Explained

C# 14 adds support for unbound generic types in nameof, so you can write nameof(Logger<>) and nameof(Dictionary<,>) without supplying throwaway type arguments. This post explains the syntax, shows practical examples for logs, exceptions, and attributes, and clarifies how nameof differs from typeof in this context.

3 min0 likes
Article / csharp

Alias any Type with C# 12

With C# 12, you can now alias type, including tuples, array, pointer, and unsafe types.

2 min0 likes
Article / csharp

Using Primary Constructors in C# 12 & .NET 8

C# 12 provides a new way to use constructors that can potentially save you time, but there are several things to watch out for.

4 min0 likes
Article / csharp

Building a Cross Platform NuGet Package

Learning to build a NuGet package by building a .NET SDK for the Deepgram API, while ensuring it's compatible with as many versions of the .NET Framework and as many platforms as possible.

5 min0 likes
Browse every topic →