What are the different types of generic collections in C#?

Beginner

Answer

List-based:

  • List<T> - Dynamic array
  • LinkedList<T> - Doubly linked list
    Set-based:
  • HashSet<T> - Unique elements, fast lookup
  • SortedSet<T> - Sorted unique elements
    Dictionary-based:
  • Dictionary<K,V> - Key-value pairs, fast lookup
  • SortedDictionary<K,V> - Sorted key-value pairs
  • ConcurrentDictionary<K,V> - Thread-safe dictionary
    Queue/Stack:
  • Queue<T> - FIFO collection
  • Stack<T> - LIFO collection