Using DateTime.Now() in your business logic can cause issues when it's time for writing tests. Here's my approach for fixing this.
With ChatGPT-4's and Hugging Face data, I built and queried my own AI model with the goal of generating C# code.
Recently, I wanted to use a method for two different concrete classes that shared an interface. The solution? Using a generic method with type constraints.
Part of a series on writing request tests for a C# Azure Functions API in xUnit, this post shows how to use reflection to locate the HTTP triggered methods.
How to configure an Azure Functions dependency injection context for request testing in xUnit, including logging and settings.
C# 7.0 introduced pattern matching support in its switch statements. Here are some examples of how you can now switch on object types, etc. in C#.
How I've evolved my C# style in the last few years using with types, immutable data structures, and fluent syntax.
Describes the MethodToDelegate library and how to use it to register methods and delegates in dependency injection.
A delegate in C# is essentially a function signature, but it is also a type that can be used as an argument to functions.
Composing C# applications with single-responsibility objects generates a lot of boilerplate.