.NET

  • Extension Methods and Extension Members in C#

    Extension Methods and Extension Members in C#

    Why This Matters When AI Can Just Write the Code An AI assistant can generate an extension method for you in seconds — a one-liner with this in front of the first parameter, done. So why does the underlying concept deserve real understanding rather than just trusting the generated snippet? Because extension methods are one of the easiest C# features to use incorrectly while still having it compile and appear to work, and the failure modes are exactly the kind that only show up once real usage patterns emerge — not in the small demo an AI tool shows you.… Go to Post

  • Interfaces, Inheritance, and Composition — How C# Types Share Behaviour

    Interfaces, Inheritance, and Composition — How C# Types Share Behaviour

    Why This Matters When AI Can Just Write the Code An AI assistant can generate an interface, a base class, or a composed object graph in seconds — so why does understanding the underlying design tradeoffs still matter? Because generating code that compiles is not the same as generating code that will still be healthy to work with a year from now, and the choices this post covers — interface vs. base class, inheritance vs. composition — are exactly the kind of decision an AI tool cannot reliably make correctly on your behalf, because making it well requires knowing things about your… Go to Post

  • Null, not null, forgiving null (or maybe not)

    Null, not null, forgiving null (or maybe not)

    Why This Matters When AI Can Just Write the Code An AI assistant can generate null checks in seconds — so why does understanding null handling matter if you can just ask for it? Because null-related bugs are almost never caught by generating code; they’re caught by reading code and recognising a gap in its reasoning, and that’s a skill no amount of code generation substitutes for. Here’s a concrete version of the problem: an AI tool asked to fix a compiler warning about a possibly-null reference will very often reach for the null-forgiving operator (!) — it makes the… Go to Post

  • C# class vs record vs struct vs record struct

    C# class vs record vs struct vs record struct

    Why This Matters When AI Can Just Write the Code It’s a fair question: if you can ask an AI assistant to generate a class, a record, or a struct in seconds, why spend time learning the difference yourself? An AI tool will happily generate any of the four — a class when you needed a record, a mutable record struct when you needed a readonly one, a struct the size of a small database row when a class would have been far cheaper to pass around. It will do this confidently and without warning you, because generating syntactically valid… Go to Post

  • C# 14 Deep Dive

    C# 14 Deep Dive

    C# 14 (shipping with .NET 10) is not a paradigm-shifting release. It’s a refinement release: a set of focused changes that remove long-standing boilerplate and close gaps that forced you into workarounds. Two of them change how you write members, and they’re the ones you’ll reach for daily. The field keyword: the missing middle of properties For twenty years, C# properties had exactly two states and nothing in between. The auto-property, concise and logic-free: public string Name { get; set; } // compiler generates a hidden backing field, but you can’t touch it And the full property, the moment you… Go to Post

  • Upgrading to .NET 10 LTS: Why This Is a Forced-Decision Year

    Upgrading to .NET 10 LTS: Why This Is a Forced-Decision Year

    If you run anything on .NET 8 or .NET 9, there’s a single date that turns “we should upgrade eventually” into “we have to upgrade this year”: November 10, 2026. On that day, both .NET 8 and .NET 9 reach end of support — simultaneously. After it, Microsoft stops shipping servicing updates, security fixes, and technical support for either version. That simultaneity is not a typo, and it’s the crux of this series. Ordinarily you’d expect the newer release to outlive the older one. Here they converge, because of a deliberate policy change: Microsoft extended Standard Term Support from 18… Go to Post

  • The Art of Low-Level Memory: Mastering Span, Memory, and ref struct

    The Art of Low-Level Memory: Mastering Span, Memory, and ref struct

    This article introduces a powerful, modern C# toolkit designed to bypass traffic jams by writing allocation-free code. We will explore Span<T>, a type-safe “window” into existing memory that lets you parse and process data without creating copies. We’ll then cover its essential, heap-friendly counterpart, Memory<T>, which is crucial for asynchronous programming. Finally, we’ll dive into creating your own ref struct types to build custom, high-speed utilities that operate entirely on the stack. Throughout this guide, we will use the practical context of our car rental application to demonstrate how these features can be used to optimize critical code paths, delivering… Go to Post

  • The Essential Guide to Basic Data Types in C#: A Journey Through the Foundations

    The Essential Guide to Basic Data Types in C#: A Journey Through the Foundations

    When diving into a new programming language, understanding its basic data types is like learning the alphabet before you write a novel. In C#, data types form the bedrock of how you work with data—whether it’s numbers, text, or more complex structures. But unlike some languages that prefer to keep things ambiguous (cough JavaScript cough), C# is strongly typed. This means every variable you declare has a specific data type, and the compiler insists you stick to it. No shortcuts. No funny business. It’s like having a very strict grammar teacher who loves semicolons. So, let’s begin our descent into the type system… Go to Post

  • C# Arrays Explained: Types, Features, and Operations

    C# Arrays Explained: Types, Features, and Operations

    Arrays are the workhorses of programming and, in C#, they play a pivotal role in managing collections of data efficiently. Understanding how to declare, manipulate, and apply them is key to unlocking the full potential of the language. What is an Array in C#? In C#, an array is a collection of elements of the same type, stored in contiguous memory locations. Arrays allow you to store and manage multiple values under a single variable name, making data handling more efficient. Arrays have the following key Characteristics: Declaring Arrays Single-Dimensional Arrays The simplest form of an array can be declared and initialised as… Go to Post