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

Covariance and Contravariance in C#

Let's talk about Contravariance and Covariance in C# using .NET Framework examples!

Contravariance and covariance are essential concepts in C# when dealing with generics, enabling us to have more flexibility when assigning generic types. So let's have examples straight from the framework itself!

Also, we will go a bit deeper and talk what some differences between generic constraints and things like Contravariance are.

Read the whole article

Preview image blogpost

.NET 8 Performance Edition

As with every .NET release, Microsoft improves the performance of the runtime and guess what: This release is no exception to this. In this blog post, I want to go through some of the improvements made so far (.NET 8 preview 3).

Read the whole article

Preview image blogpost

5 useful extensions for Task<T> in .NET

In this short blog post, I will show you 5 useful extensions for Task in .NET. We will build them as extension methods, so there are easy to use. On top, I will show a small example of how to use them. So let's go!

Read the whole article

Preview image blogpost

Source Generators and Regular Expressions

Source Generators are more and more an integral part of the .NET ecosystem. But how does that play together with everyone's favorite: Regular Expressions?

In this blog post we will dive in how we can leverage source generators in combination with regular expression to have a debuggable, but also very performant way of executing regular expressions!

Read the whole article

Preview image blogpost

LINQ on steroids with SIMD

In this blog post, we will explore the use of SIMD instructions to speed up LINQ queries. We will use the Vector type of performing SIMD operations on arrays of data. We will also use the BenchmarkDotNet library to measure the performance of our code. We will also see how this works hand in hand with the new "generic math" feature of C# 10.

Read the whole article

Preview image blogpost

Creating a ToolTip Component in Blazor

In this blog post we will create a ToolTip component in Blazor from scratch. We will use the Blazor WebAssembly template to create a new project. We will then add a ToolTip component to the project and use it in the Index page. We will also add some styling to the ToolTip component.

The advantage over using a library is that we can customize the component to our needs as well as keeping it simple! So let's get started!

Read the whole article

Preview image blogpost

C# Source Generators: How to get build information?

Source generators are a powerful feature introduced to C#, allowing developers to generate additional code during the compilation process automatically. They can help reduce boilerplate, improve performance, and simplify your codebase.

This blog post will introduce source generators, discuss how they work, and walk through an example of a source generator for generating build information.

Read the whole article

Preview image blogpost

Leverage 'is not' Operator for Exception Filtering!

Did you know you can use the 'is not' operator with exception filtering to simplify and improve your error handling in C#?

In this short blog post, I will show you how to use it.

Read the whole article

Preview image blogpost

Caching in .NET with MemoryCache

In this blog post, we will discuss how we can "cache" entries from the database. We will talk about why we would do this in the first place and how to achieve that.

Also, we will talk about some implications and what "cache invalidation" is.

Read the whole article

Preview image blogpost

Write your own AutoMapper in C#

Sometimes you have to map an object to another representation in C#. And you think: Why isn't C# duck-typing capable?

You might hear of libraries like AutoMapper that do the tedious work of mapping one object to another with the same structure. This blog post will give a super simple introduction to how those libraries are working internally.

In the end a bit of a subjective topic on whether or not I would use such libraries.

Read the whole article

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