C# Programming Language Articles

C# is Microsoft’s modern, statically-typed language for .NET development. This collection explores C# features, language evolution, practical patterns, and techniques for writing clear, efficient code in the C# ecosystem.

Language Evolution and Features

C# has evolved significantly since its creation, adopting features from other languages and innovating independently. Modern C# (10+) includes records for immutable types, nullable reference types for null-safety, pattern matching for elegant code flow, and async/await for asynchronous programming.

Records provide concise syntax for immutable data types with structural equality, ideal for domain models and data transfer objects.

Nullable Reference Types make null-safety explicit at compile time, preventing the infamous “billion-dollar mistake” of null reference exceptions.

Pattern Matching enables elegant code for type checking, null checking, and property matching without verbose if-else chains.

Async/Await abstracts the complexity of asynchronous programming, enabling responsive applications without callback hell.

Practical C# Development

Articles in this section cover language features, effective C# patterns, performance optimization, LINQ mastery, and integration with .NET libraries. Topics include null handling strategies, immutability patterns, error handling approaches, and leveraging type system features.

The goal is writing C# code that’s not just correct but also expressive, maintainable, and performant—code that communicates intent clearly and resists bugs through type safety and language features.

Gradually Introducing Nullability in Legacy Code: A Practical Guide for .NET and C#

Gradually Introducing Nullability in Legacy Code: A Practical Guide for .NET and C#

As developers, we’re often tasked with maintaining and modernizing legacy codebases that were written long before some of the best practices of today—such as nullability annotations—were available. While modern C# now supports nullable reference types, enabling us to avoid the dreaded NullReferenceException, introducing this feature to existing, large codebases can be a challenge.

In this article, I’ll share my step-by-step approach for introducing nullability into a legacy .NET and C# project. You’ll learn how to apply nullability in a controlled, incremental manner using project-level settings, scoped annotations, and file/method-level directives, all while maintaining the integrity of your legacy codebase. After all, modernizing your code doesn’t have to be an all-or-nothing endeavor—gradual change is key to a successful transition. Let’s get started!

Mastering .NET Project Properties: The `BuildingInsideVisualStudio` Flag

Mastering .NET Project Properties: The `BuildingInsideVisualStudio` Flag

In the ever-evolving world of .NET development, managing project configurations effectively is crucial for maintaining a clean and efficient build process. One of the less frequently discussed but highly useful properties is BuildingInsideVisualStudio. This property, when correctly utilized, can streamline your build process and ensure that your project is configured properly depending on the build environment. In this article, we’ll explore the BuildingInsideVisualStudio property with concrete examples and discuss best practices for using it effectively.

Manage NuGet Packages Centrally

Manage NuGet Packages Centrally

For over 12 years, NuGet package management has been part of the .NET ecosystem with direct integrations to various IDEs, CLIs and build systems. But a feature took 12 years before it appeared and certainly needs some more maintenance until it is mature!