NDepend Blog

Improve your .NET code quality with NDepend

Alternate Lookup for Dictionary and HashSet in .NET 9

September 10, 2024 3 minutes read In .NET 9, a new method called GetAlternateLookup<TKey, TValue, TAlternate>() has been introduced for hash tables classes, including Dictionary<TKey, TValue>, HashSet<T>, ConcurrentDictionary<TKey, TValue>, FrozenDictionary<TKey,...
NDepend September 10, 2024

Faster Dictionary in C#

September 2, 2024 5 minutes read In the .NET Base Class Library, Dictionary<TKey, TValue> is an essential key-based hashtable providing constant time access to values. This means accessing dictionary[key] takes...
NDepend September 2, 2024

Improve C# code performance with Span<T>

April 24, 2024 9 minutes read Welcome to our exploration of System.Span<T> and System.ReadOnlySpan<T>, two powerful structures introduced in C# 7.2 back in 2017. As a type-safe way to access...
NDepend April 24, 2024

.NET 8 Top 10 New Features

April 24, 2024 7 minutes read .NET 8 has been officially released in November 2023. You can download it here. Designated as an LTS (Long Term Support) version, it guarantees...
NDepend April 24, 2024

WPF vs WinForms – Making the Right Decision in 2024

April 24, 2024 7 minutes read If you’re a developer faced with the decision of selecting between Windows Presentation Foundation (WPF) and Windows Forms (WinForms) commonly referred to as WPF...
NDepend April 24, 2024

.NET Micro-Optimization and Refactoring Trick

May 31, 2023 3 minutes read Recently, I made an interesting observation regarding Dictionary<string,T>: the method TryGetValue() is faster when building  with new Dictionary<string,T>(StringComparer.Ordinal). This performance difference can be attributed...
NDepend May 31, 2023

Managed pointers, Span, ref struct, C#11 ref fields and the scoped keyword

October 25, 2022 9 minutes read The concept of managed pointer exists in the NET runtime and C# since the inception of the platform in the early 2000. Managed pointers...
NDepend October 25, 2022