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

Generator-Function in C# - What does yield do?

Since the introduction of C# 2.0 we have the yield keyword with in combination with the IEnumerable<T> type works as a generator function. We can return elements one by one.

But how does that thing work internally? And what does it have to do with async / await?

Read the whole article

Preview image blogpost

Task vs ValueTask - The what's, when's and how's

Since .NET Core 2.0 the Type ValueTask. It seems that there is a lot of overlap between Task and ValueTask. So let's have a deeper look into ValueTask. Where should we use it and how should we use it properly? And also: where we should not use is.

Read the whole article

Preview image blogpost

Lifetime Scope in Blazor Client and Server Apps

You probably are well aware of the Lifetime Scope for ASP.NET Core website. There are basically 3 scopes: Transient, Scoped and Singleton. Let's have a look how they differ in Blazor Client and Server.

Read the whole article

Branch Prediction - How much does an if cost?

In the blog post we will look a bit into branch prediction. What is it and how can it impact our code?

To explore this we will be Thomas the Signalman, which works at a very busy railroad.

Read the whole article

Preview image blogpost

ILGPU - Processing Data on your GPU (CUDA / OpenCL in C#)

If you ever needed a massive amount of data processed in parallel you might had a look at OpenCL or CUDA. Both are based on a subset of C to describe the program your GPU has to execute.

So let's have a look how we can achieve this in the .NET way. Furthermore I'll give you some insights about GPGPU (General-purpose computing on graphics processing units) in general. Also some limitations and big differences to conventional "CPU"-Programming.

Read the whole article

Preview image blogpost

static abstract interfaces and generic math

Besides the big announcements of .NET 6 there are also some smaller features. I want to show case a special one: static abstract interfaces. With this you have ability to extend the contract in that sense, that an implementing class has to provide also static methods. This feature is right now flagged as preview, but you can use it if you want.

This also enables generic math operations on an interface level.

Read the whole article

Preview image blogpost

A better enumeration - Type safe from start to end

Enumerations are one of the fundamental value types in C#. enum's are handy if you have a constrained set of allowed values. But the enum type also has a lot of drawbacks. Personally, one major issue for me is that you can't define methods inside the enum. Plus, you can just pass them invalid values and it just works (Todd Howard I'm looking at you).

So why not make a lightweight alternative which removes a lot of the shortcomings of an enum?

Read the whole article

Preview image blogpost

git hook - prefix your commit message with your JIRA ticket

In this short blog post I'll show you how you can automatically prefix your commit messages with the JIRA ticket derived from your branch name.

Read the whole article

Preview image blogpost

API Versioning in ASP.NET Core made easy

How can we have versioning with a public facing REST API in ASP.NET Core? This blog post will show you the foundation how to setup and configure versioning. Furthermore I will give you some ideas how to structure your code and what kinds of versioning you can do.

In the end you should be able to have the same endpoints with multiple versions.

Read the whole article

Preview image blogpost
  • 9/10/2021
  • 19 minute read

git - useful aliases

In this article I'll show you some of my most used git aliases which make my everyday work easier and more productive.

Read the whole article

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