In C#, classes and objects can be categorized as mutable or immutable based on whether their state can be changed after they are created. Understanding the distinction between mutable and immutable types is crucial for designing robust, maintainable, and performant applications. Mutable Classes Mutable classes are those whose state or data can be modified after … Continue reading Why Should I Care about Mutable vs. Immutable Types
Blog Feed
“NuGet Why” Command: Understanding Dependency Graphs in .NET Projects
Introduction Managing dependencies in .NET projects can sometimes be a challenging task, especially when trying to understand how various packages interrelate in your solution. Enter the dotnet nuget why command—a powerful tool introduced in the .NET 8.0.4xx SDK and later versions. This command allows you to visualize and analyze the dependency graph for a specific … Continue reading “NuGet Why” Command: Understanding Dependency Graphs in .NET Projects
Why Should I Care About Functional Programming in C#?
Functional programming (FP) is a programming paradigm that emphasizes immutability, first-class functions, and expressions over statements. While C# is primarily an object-oriented language, it has incorporated many functional programming features over time, particularly since C# 3.0 and with further enhancements in later versions. Here's why you should care about functional programming when working with C#: … Continue reading Why Should I Care About Functional Programming in C#?
UUID v7: Enhancing Sortable Unique Identifiers for Developers
.NET 9 brings an exciting new feature for developers: UUID v7. This new version of UUID integrates a timestamp into the traditionally random UUID structure, offering significant advantages for databases and other systems requiring sortable unique identifiers. It also still produces IDs that follow the GUID format, so they are compatible with other unique IDs … Continue reading UUID v7: Enhancing Sortable Unique Identifiers for Developers
Endpoint Explorer in Visual Studio
(Version: Visual Studio 17.6+) HTTP files are a popular feature in VSCode and were brought into Visual Studio too. Recently, I learned about another cool endpoints feature in Visual Studio called the Endpoints Explorer. This tool window lists all of the endpoints of your Web API project. You can find the Endpoints Explorer by going … Continue reading Endpoint Explorer in Visual Studio
Global Using Directives
In C# 10, a new feature was introduced that allows you to specify global using directives. This feature lets you define using directives that apply to all the files in your project, reducing the need for repetitive using statements in each file. This can be particularly useful for commonly used namespaces. How to Specify Global … Continue reading Global Using Directives
Integration Tests for Minimal API with SQL Server TestContainers
Integration tests are important for ensuring that your application components work together as expected. When it comes to testing APIs, having a reliable and isolated database environment can significantly improve the accuracy of your tests. By using test containers over other concepts like in memory database, you will actually test the behavior end-to-end, including the … Continue reading Integration Tests for Minimal API with SQL Server TestContainers
Using glob patterns in *.csproj files
Here's a cool article on simplifying your csproj files by using glob pattern for paths and file extensions https://mykeels.medium.com/using-glob-patterns-in-csproj-files-95122c7f0870 Glob patterns are like wildcard-based rules that match file paths. They let you specify file patterns using wildcards like * and ** to match multiple files with similar characteristics. In this case, we want to target all C# files (*.cs) … Continue reading Using glob patterns in *.csproj files
Creating Interactive Console Applications in C#
Console applications (or command line interfaces - CLI) have long been a staple for developers due to their simplicity and ease of use. However, with the right tools and techniques, you can build sophisticated console applications that are both interactive and user-friendly. Let's explore how to create advanced console applications in C# using Spectre.Console.Cli for … Continue reading Creating Interactive Console Applications in C#
Using GenericHost in a C# Console Application
Introduction Building useful console applications often requires structured logging, configuration management, and dependency injection. The .NET Generic Host framework provides a powerful foundation to enable these features. Let's explore how to use GenericHost in a C# console application, with a specific focus on creating a simple command-line parser. This parser will interpret and reprint command … Continue reading Using GenericHost in a C# Console Application