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

Prerendering Blazor Apps - How does it work / tips and tricks

Blazor comes with the option to prerender your webpage on the server. This works for the client-side version as well as the server side version of Blazor.

Let's have a look how does it work and what might be some pitfalls and how can we come around those.

Read the whole article

Preview image blogpost

Enum.Equals - Performance analysis

Did you know that you can spend 100x times longer depending how you compare your enums?

Of course we are speaking here in terms of nanoseconds but this story is much more then just numbers. We'll also talk about boxing and unboxing. So let's dive right into it.

Read the whole article

Preview image blogpost

Lazy load components with Blazor - Virtualize in Action

Since .NET5 we have the ability to "virtualize" a component.

But what exactly is that and how do we use it? This blog post will show you a lot of details about the <Virtualize> tag.

Read the whole article

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

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