Hey, I'm Steven a .NET Developer and Freelancer in Zurich, Switzerland. I am a Microsoft MVP.
Also, this blog is open source on GitHub.

Recent Posts

Preview image blogpost

Turn on Nullability checks by default

Since C# 8, we have nullable reference types. The word sounds odd, given the fact that reference types are always nullable. The idea is that the default is that your reference types have to be properly initialized. Here are my thoughts after a few years of using them.

Read the whole article

Preview image blogpost

The "Weak Event" Pattern in C#

Events in C# are a powerful mechanism for decoupling components and enabling a publisher/subscriber model. However, they have a significant drawback: the publisher holds a strong reference to the subscriber, and this can cause memory leaks. This article describes a pattern for implementing weak events in C#.

Read the whole article

Preview image blogpost

Expression-bodied members in properties

Are these two expressions the same?

public class MyClass
{
    public int A { get; } = Random.Shared.Next(1000);
    public int B => Random.Shared.Next(1000);
}

Read the whole article

Preview image blogpost

Enum.TryParse unexpected behavior

Enums are very simple structures, but some functions like Enum.TryParse can have unexpected behavior. In this short blog post, we discover why and what are the alternatives.

Read the whole article

Preview image blogpost

Creating Your Own Fakes Instead of Using Mocking Libraries

With respect to the current topic around Moq, I want to showcase how you can easily roll out your own fakes so that you are not depending on a third party library.¨

Read the whole article

Preview image blogpost

What's going on with Moq? SponsorLink and burnt soil!

The famous Moq library faced some criticism due to the usage of SponsorLink. What is the problem, and what is going on here? And obviously, I will add all the sources to the articles.

Read the whole article

Preview image blogpost

Keyed Services in the IServiceProvider in .NET 8 preview 7

The .NET 8 preview 7 will bring another exciting feature some of you probably awaiting for a long time: Keyed services.

Read the whole article

Preview image blogpost

The combined power of F# and C#

Where C# is the most dominant language in the .NET world, other languages are built on top of the Framework that deserves their respective place. F# is strong when it comes down to functional programming! In this blog post, we will leverage the power of F# and C# to showcase where both excel!

Read the whole article

Preview image blogpost

Gracefully Handling Entity Framework Exceptions with EntityFramework.Exceptions

Working with databases can sometimes be daunting, mainly when errors occur. These errors or exceptions can be due to many reasons, such as constraint violations, connection issues, or syntax errors. Entity Framework throws a generic DbException or DbUpdateException for most of these database issues. But we cand get more specific exceptions based on the concrete "problem"! That's where EntityFramework.Exceptions comes in.

Read the whole article

An error has occurred. This application may no longer respond until reloaded. Reload x