Similar Posts

.NET 8 performance: 10x faster GetGenericTypeDefinition
.NET 8 brings some neat performance for existing APIs that handle type information. One such API that has seen a significant improvement is GetGenericTypeDefinition. In my benchmarks, the .NET 8 implementation is almost 10 times faster compared to the .NET 7 version. You can run this benchmark yourself if you’d like using BenchmarkDotNet: Or if…
What’s new in C# 14.0
C# 14.0 will be released in November 2025, at the same time as .NET 10. C# 14.0 is currently in preview:

.NET 8 Performance: UnsafeAccessor vs. Reflection
In a previous article we covered how to access private members using UnsafeAccessor. This time around, we want to look at it’s performance compared to Reflection, and to see whether it’s truly zero-overhead or not. We’re going to do four benchmarks. If you want to run the benchmarks yourself, you have the code below: Benchmark…
.NET Performance: ToList vs ToArray
.NET 9 brings significant improvements to LINQ’s ToArray method, both in terms of speed, as well as memory allocation. To achieve this, the new implementation makes use of new runtime features such as InlineArray and ArrayPool to significantly reduce memory allocations and improve speed, especially when dealing with an IEnumerable<T> of unknown length. If you’re curious about…
NET 8 – How to use JsonStringEnumConverter with native AOT
JsonStringEnumConverter is not compatible with native AOT. To fix that, NET 8 introduces a new converter type JsonStringEnumConverter<TEnum> that is compatible with native AOT. To use the new type, simply annotate your types as follows: Keep in mind: enum deserialization is case insensitive, while serialization can be cusomized via JsonNamingPolicy. What happens if you try…
C# – How to shuffle an array?
The easiest way to shuffle an array in C# is using Random.Shuffle. This method has been introduced in .NET 8 and works both with arrays and spans. The suffling is done in-place (the existing array/span is modified, as opposed to creating a new one and leaving the source unchanged). In terms of signatures, we’ve got:…