Govt. Exams
Entrance Exams
ConcurrentDictionary<K,V> from System.Collections.Concurrent is thread-safe for multi-threaded applications, unlike Dictionary<K,V>.
IEnumerable<T> only provides iteration. ICollection<T> extends it with Count property and methods like Add(), Remove(), Clear() for modification.
OrderByDescending sorts by Age in descending order. ThenBy applies secondary sort by Name in ascending order. This is a multi-level LINQ sort.
HashSet<T> requires O(n) space to store n unique elements. Hash tables require linear space proportional to the number of stored elements.
Both FindAll() and Where() (LINQ) can filter collections. Where() returns IEnumerable and is more modern. FindAll() returns a List directly.
The 'base' keyword in the constructor initialization list ensures the parent class constructor is called before the derived class constructor body executes, maintaining proper initialization order.
C# allows one implementation to satisfy multiple interfaces when they have the same method signature. Explicit interface implementation can be used if methods need different behaviors.
The sealed keyword on a virtual method prevents overriding in derived classes, ensuring that implementation is locked in the current class.
IEquatable<T> provides type-safe equality comparison, improves performance by avoiding boxing, and is essential for proper behavior in collections like Dictionary.
C# doesn't support multiple inheritance of classes, but allows one base class and multiple interfaces, providing flexibility while maintaining hierarchy.