Govt. Exams
Entrance Exams
For one-to-many relationships with concurrent access, combining ConcurrentDictionary with ConcurrentBag (or List) provides thread-safe multi-value storage per key.
SortedList<K,V> maintains sorted order by keys and allows O(1) index-based access. SortedSet<T> doesn't support indexing.
MemoryCache provides LRU-style eviction and memory management policies. Basic collections don't have built-in LRU functionality.
TryGetValue() uses hashing for lookup, providing O(1) average case complexity regardless of dictionary size.
SelectMany() (also called flatMap in other languages) flattens nested sequences and creates a cartesian product of collections.
BlockingCollection<T> supports blocking operations for producer-consumer patterns, allowing threads to wait for items or space.
SortedDictionary provides O(log n) lookup and maintains sorted order during iteration. Alternatives are slower or require post-processing.
Distinct() is the standard LINQ method for removing duplicates. While HashSet works, Distinct() is more idiomatic.
Clear() removes all elements but doesn't deallocate capacity. The dictionary remains usable with count=0.
LinkedList<T> has Reverse enumerator for efficient reverse iteration. Others don't have built-in reverse iteration support.