CSharp examples for System.Collections.Generic:List
Ensures the capacity of the list to be greater or equal than the specified.
using System.IO;/*from ww w . ja v a2 s .c o m*/ using System; public class Main{ /// <summary> /// Ensures the capacity of the list to be greater or equal than the specified. /// </summary> /// <param name="list">The list to be checked.</param> /// <param name="capacity">The expected capacity.</param> public static void EnsureCapacity(System.Collections.ArrayList list, int capacity) { if (list.Capacity < capacity) list.Capacity = 2 * list.Capacity; if (list.Capacity < capacity) list.Capacity = capacity; } }