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
Category: Coding Tips
Creating a Fluent API in C#
Introduction Fluent API is a design pattern that provides more readable and intuitive code by chaining method calls together. This type of API is commonly used in implementing the Builder design pattern. This style enhances code readability, reduces boilerplate, and makes APIs easier to use. Fluent APIs are commonly seen in libraries like LINQ and … Continue reading Creating a Fluent API in C#
Parameter Validation Using ArgumentExceptions
In the latest .NET versions, argument validation has been streamlined with new helper extension methods that make it even easier and more expressive to throw argument exceptions. Some of these methods were first introduced in .NET 6 but have been enhanced with subsequent releases. Here are some of the latest ways to handle argument validation … Continue reading Parameter Validation Using ArgumentExceptions