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.

Older Posts

Preview image blogpost

LINQ // Skip and Take

Skip and Take are used for pagination or limit the number of elements returned by a query.

Since C# 8 you can use Take with a Range. Let's see some examples.

Read the whole article

How to write your own cron Job scheduler in ASP.NET Core (like Quartz, Hangfire, ...)

In this blog post we will discover how to write your own small task scheduler / job scheduler with cron notation in ASP.NET Core. You might know similar approaches under the name of Quartz or Hangfire.

With the help of BackgroundService we will build our own, lightweight version of it.

Read the whole article

Preview image blogpost

Benchmarking - A matter of perspective

In recent months and years, there was a certain hype around benchmarking, also in the .NET community.

This blog post is meant to ground some of the benchmarking topics and put this into relation to other things so you get a better understanding if it's worth the effort.

Read the whole article

Preview image blogpost

Is a square a rectangle? Liskov substitution principle in action

I will put that simple question in the room: "Is a square a rectangle?" And you might thank: "Well dah, of course!"

But wait for a second and let's check it together. We will use the L in SOLID: The Liskov Substitution principle to check if this relationship makes sense for us!

Read the whole article

Preview image blogpost

The Humble Object Pattern

The Humble Object Pattern is a design pattern to make especially unit testing easier with the goal of separating behaviors that are easy to handle (domain logic) from behaviors that are hard to handle (like external events or dependencies).

So let's have a look at what it is and how you can utilize it.

Read the whole article

Preview image blogpost

Performance (ReadOnly)List vs Immutable collection types

A bit back on LinkedIn, there was a discussion about read-only collection and immutability where this is not the point I want to discuss now, as I already covered that here: "ReadOnlyCollection is not an immutable collection".

This post is just about the performance of those types compared to our baseline, the good old List<T>. It also explains why we see the results we see.

Read the whole article

Preview image blogpost

From Testing Pyramid to Diamond

In this article, we will discuss the testing pyramid - what it is and what are some problems with that.

We will also discuss a different approach: The testing diamond.

Read the whole article

Preview image blogpost

Getting git version information in your C# code

Did you ever need git-specific information like the latest tag or the current commit inside your C# code? Or even the semantic version number of your current build=

Well, there is an easy solution involving source generators.

Read the whole article

Preview image blogpost

error NETSDK1194: The "--output" option isn't supported when building a solution.

Did you see the following error in recent days in your build-pipeline:

error NETSDK1194: The "--output" option isn't supported when building a solution.

If so - that is not necessarily your fault at all! Microsoft released a new SDK version, which breaks your builds. Let's see why and what we can do to tackle that.

Read the whole article

Preview image blogpost

A (performance) quirk with JsonSerializer

System.Text.Json.JsonSerializer has a weird quirk in regard to performance and memory management. So we will discuss what is "wrong" with this code: JsonSerializer.Serialize(myObject, new JsonSerializerOptions(...));.

Read the whole article

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