| Collection | Use |
|---|---|
| List<T> | Dynamic array |
| Dictionary<K,V> | Key → value (hash table) |
| HashSet<T> | Unique items |
| Queue<T> / Stack<T> | FIFO / LIFO |
| Array (T[]) | Fixed size |
var nums = new List<int> { 5, 2, 8 };
nums.Add(1);
nums.Sort(); // 1 2 5 8
var ages = new Dictionary<string, int>();
ages["Rahim"] = 25;
if (ages.TryGetValue("Rahim", out int age))
Console.WriteLine(age);
// generic method
static T Max<T>(T a, T b) where T : IComparable<T> => a.CompareTo(b) > 0 ? a : b;