C#

Discriminated Unions in C# using OneOf

Ever wish you could act on different types of variables — effectively switching by object type and taking different action depending on which class is present? Discriminated Unions from functional programming languages offer an answer to this. In this article I explore the good and bad of Discriminated Unions in C# and […]

Creating a .NET Core API

This article will walk you through some simple steps in creating, running, and testing a new ASP .NET Core Web API. Prerequisites I will be using .NET Core 2.1 as it’s what I have installed on my machine, though today Release Candidate 1 of .NET Core 3 came out. To get started: Download […]

Action-Oriented C#

Five years ago I hit a plateau. My code hit a certain level of quality and flexibility and stopped improving. Here’s how I used aspects of functional programming to keep climbing. My code was pretty SOLID, but there was still a lot of very similar code, despite actively trying to […]

Safer Code with C# 8 Non-Null Reference Types

Null reference exceptions are one of the most frequent errors encountered in .NET applications. As powerful as the framework is, it’s built around a core assumption that reference types can point to null, so any code that works with a reference type needs to either know already that the object is […]

Annotating Nulls in C#

In my prior post I talked about using functional programming null handling features. While this is a valid approach, it is also one that requires a lot of code changes to achieve. If you don’t want to make that drastic of a level of changes, there are a few other […]