12 May 2023

12 May 2023


Converting Strings to .NET Objects – IParsable and ISpanParsable 🔗

TBH I didn't yet quite understand the purpose of this, but it's good to know that it's there when I find myself with this problem. As well as describing the IParsable interface, it also describes how static member methods on interfaces can be useful.

C# "var" with a Reference Type is Always Nullable 🔗

This is unexpected:

You might expect that person is a Person in this code

var person = new Person();

and you'd be right if nullable reference types are disabled. But if you enable Nullable then person is a Person?, ie it's nullable.

Static and non-static interface member calls in .NET: they are not the same 🔗

On a similar subject, this article goes into another maybe unexpect effect of static abstract interface members, namely that calling a static interface method "avoids the cost of invoking via virtual methods" that normal interface methods have.

Validating Connection Strings on .NET Startup 🔗

A nice idea if that's what you want to do, but it's just code - not really specific to .NET Startup, apart from that's where he called it.

C# 11.0 new features: Span<char> pattern matching 🔗

Interesting article about Span and switch.

A quick tour of dictionaries in C# 🔗

Exactly what it says - a quick summary of the different dictionaries in C#, as well as a few things that are similar to dictionaries.