/// <summary> /// Instantiate the list with a given capacity and given enumerable. /// </summary> /// <param name="capacityChunk">The starting capcity for the list.</param> /// <param name="collection">An array of T elements.</param> public static List <T> NewList <T>(EListCapacityType capacityChunk, IEnumerable <T> collection) { Contract.Requires(collection != null); List <T> internalList = new List <T>((Int32)capacityChunk); internalList.AddRange(collection); return(internalList); }
/// <summary> /// Instantiate the list overriding the Microsoft default starting capacity of 4 by a EListCapacityTypes enum. /// </summary> /// <param name="capacityChunk">The starting capcity for the list.</param> /// <remarks> /// By instantiating a list with the approximate capacity to the ultimate count, saves performance hits each time /// the capacity needs to be expanded to account for the large size. The EListCapacityTypes is a /// logrithmic scale of 10, 100, 1000 (Minium, Medium, Maximum respectively). /// </remarks> public static List <T> NewList <T>(EListCapacityType capacityChunk) { return(new List <T>((Int32)capacityChunk)); }