What is a List<T> in C# and when should you use it?
List<T> is a generic collection in C# that represents a dynamically sized list of elements.
It resides in the System.Collections.Generic namespace and grows or shrinks as
needed.
Use it when:
- You need a resizable array-like structure
- You want to perform frequent insertions, deletions, and searches
Example:
List<string> names = new List<string>();
names.Add("Alice");