When building a web server in ASP.NET Core, the APIs that deal with status codes are int based, there are multiple ways to express a status code in your code, in this post I will share my favourite. // Stop…
csharp
A collection of 7 posts
Defer with C# 8.0
Go (https://golang.org) has a really nice little language feature called defer, which is a keyword that lets you defer a statement until the current function returns, and you can see an example here. Given all the new language…
C# 8.0 and .NET Standard 2.0 - Doing Unsupported Things
If you haven't heard, C# 8.0 is not supported on anything below .NET Core 3. This is in part due to the fact that some of the features cannot run on runtimes below .NET Core 3, and rather than…
A Look at JsonDocument and System.Text.Json
Today I was writing a tool that needed to handle JSON, the content was relatively large and I only needed to pick out a few parts of the structure, and thought to myself this would be the perfect time to…
Testing with HttpClient Interception
In my last post I showed how to automatically generate a typed client for use with HttpClientFactory from a swagger file. Now I want to make changes to the client's behaviour and need unit tests, in this post I will…