Endjin - Home

C#

This is part of a series of articles about faux amis in programming languages—constructs that can fool us through a misleading resemblance to one another: C# 8 surprising patterns (Introduction) C# faux amis 1: discards and underscores C# faux amis 2: tuple deconstruction and positional patterns (you are here) C# faux amis 3: variable declarations […]


C# faux amis 1: discards and underscores

by Ian Griffiths

This is the second in a series of articles: C# 8 surprising patterns (Introduction) C# faux amis 1: discards and underscores (you are here) C# faux amis 2: tuple deconstruction and positional patterns C# faux amis 3: variable declarations and type patterns In the introduction, I described the idea of faux amis in spoken languages […]


C# 8 surprising patterns

by Ian Griffiths

Recently, I made a surprising discovery. I had downloaded a preview of Visual Studio 2019 and was experimenting with some of the new language features in C# 8, when I discovered something: Switching between var and int can sometimes move type checks from compile-time to runtime. This shocked me. The experimental evidence (which I’ll get […]


Since .NET 4.0, the ConcurrentDictionary<TKey, TValue> collection type has been available as a way of ensuring thread-safe access to a collection of key/value pairs, using fine grained locking. The collection also has AddOrUpdate and GetOrAdd methods that accept delegate value factories, so that you can lazily load your values only when you need to initialize them. […]