Lists in C#
Unlike Arrays, Lists are dynamic. They can grow or shrink in size automatically.
Creating a List
You need to use using System.Collections.Generic;.
csharp List<string> names = new List<string>(); names.Add("John"); names.Add("Jane");
names.Remove("John"); Console.WriteLine(names.Count);
Benefits
- Dynamic sizing.
- Built-in methods for sorting and searching.