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

Older Posts

Preview image blogpost

Frozen collections in .NET 8

.NET 7 was freshly released but Microsoft does not sleep. .NET 8 is already in the making and I want to showcase to you one new area where the dotnet team is working on Frozen collections.

So let's have a look at what frozen collections are and how they are working.

Read the whole article

Preview image blogpost

"Use always a StringBuilder" - Internet myths

Use always a StringBuilder

That is what you can read from time to time. The basic idea is, that a StringBuilder is "better" to be defined.

Why are people telling that lie? Let's discuss this and see what it isn't true.

Read the whole article

Preview image blogpost

How to get allocations in .NET? And how big is an empty array?

Often times we hear about allocations on the heap. How can we easily measure this? This article will show you a very easy way of doing so.

Plus we will answer the question how big is an empty array? And if you think 0 bytes, then spoiler alert, that is not the case at all.

Read the whole article

Preview image blogpost

Anonymous test data with AutoFixture

Often times we have unit or integration tests that rely on some input data. The easiest solution is just to take some hard-coded values and move on with life. This has some major downsides:

Giving specific values in a test carries meaning, but we are often times not interested in that. We just need to pass the object around to fulfill the API. Also the simplest solution to fulfill your test is literally checking against those values.

Here is an elegant solution to that problem: AutoFixture. I will show you what it can do, especially in combination with xUnit.

Read the whole article

Preview image blogpost

Mutable value types are evil! Sort of...

You might have heard that mutable value types are evil. But why is that and why does the .NET framework use them then? Are they really that evil?

Let's have a look at a few examples and have a look what is going on!

Read the whole article

Preview image blogpost

Marking API's as obsolete or as experimental

Often times your API in your program or library evolves. So you will need a mechanism of telling that a specific API (an interface or just a simple method call) is obsolete and might be not there anymore in the next major version.

Also it can happen that you have a preview version of a API, which might not be rock-stable and the API-surface might change. How do we indicate that to the user?

Read the whole article

Preview image blogpost

Infographics Compendium III - Exceptions, EF Sanitized, Operators, ...

This edition has the following infographics:

  • DebuggerDisplayAttribute
  • Entity Framework input and LINQ - is it safe?
  • ExceptionDispatchInfo
  • implicit and explicit operator

Read the whole article

Preview image blogpost

local functions vs lambda expressions

.NET knows local functions and lambda expressions. You can almost take them interchangeably, but there are also some differences between them.

This article will show the differences between them.

Read the whole article

Preview image blogpost

Throwing exceptions - Why is my stack trace lost?

You might have read, that re-throwing an exception like this: throw exc; is considered bad practice and you should just do this: throw; instead.

But why is it like that?

Read the whole article

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