Essential C# Overview of C# collections  Suggest an edit

ListT

List is a list of a given type. Items can be added, inserted, removed and addressed by index.

using System.Collections.Generic;

var list = new List<int>() { 1, 2, 3, 4, 5 };
list.Add(6);
Console.WriteLine(list.Count); // 6
list.RemoveAt(3);
Console.WriteLine(list.Count); // 5
Console.WriteLine(list[3]);    // 5

List can be thought of as an array that you can resize. Enumerating over the collection in order is quick, as is access to individual elements via their index. To access elements based on some aspect of their value, or some other key, a Dictionary will provide faster lookup.


Table Of Contents
22 Enum
24 Overview of C# collections
25 GUID
107 Stream
108 Timers
  ↑ ↓ to navigate     ↵ to select     Esc to close