Browse by Topic
Popular
Popular Posts
Latest
Latest C# Posts
C# Dictionary ContainsValue: Usage and Performance
c# dictionary containsvalue: Learn how Dictionary.ContainsValue works, its O(n) complexity, equality rules, and when to use it instead of ContainsKey or alternative st...
Using C# Dictionary ContainsKey Effectively
Learn how to use C# Dictionary.ContainsKey for safe key lookups, avoid double lookups, and compare its performance tradeoffs with TryGetValue in common dictionary patterns.
Using C# Dictionary TryGetValue for Safe Lookups
Learn how Dictionary.TryGetValue performs a single lookup for key existence and value retrieval, when it beats ContainsKey plus the indexer, and how it handles null values.
C# Dictionary Get Value: Safe Lookup Patterns
Retrieve values from a C# Dictionary with the indexer, TryGetValue, or ContainsKey, and learn about null handling, custom comparers, and concurrency.
C# Dictionary Update Value: Indexer vs TryGetValue
Learn how to update values in a C# Dictionary using the indexer and TryGetValue. Compare behavior for existing and missing keys, avoid common pitfalls, and use ConcurrentDictionary for thread-safe updates.
C# Dictionary Add: Syntax, Exceptions, and Performance
Learn how to add entries to a C# Dictionary with Add, the indexer, and TryAdd. See how duplicate keys behave, when exceptions occur, and how to choose the right insertion approach.
C# Dictionary Initialization: Syntax and Tradeoffs
Learn the main ways to initialize a Dictionary in C#: collection initializers, constructors, Add methods, and LINQ, with performance tradeoffs and common pitfalls.
C# Dictionary Declaration: Syntax and Initialization
Learn how to write a C# dictionary declaration with type parameters, collection initializers, initial capacity, custom comparers, and performance tradeoffs.
C# Dictionary Usage: Key Operations and Performance
Learn practical C# Dictionary operations: fast key-value lookups, missing-key handling, performance considerations, and thread-safe alternatives.
Remove Duplicates from a List in C#
Learn how to remove duplicates from a List<T> in C# using LINQ Distinct, HashSet, and custom comparers, with performance tradeoffs, order preservation, and in-place removal.