Search

List

the List type provides an efficient and dynamically-allocated array. It does not provide fast lookup in the general case—the Dictionary is better for this. List is excellent when used in loops.
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
 // Use the List type.
 List list = new List();
 list.Add("cat");
 list.Add("dog");

 foreach (string element in list)
 {
     Console.WriteLine(element);
 }
    }
}