public string Copy() { using Rist <string> list = CreateAndPopulateList(); string[] array = list.ToArray(); return(string.Join(", ", array, 1, 3)); }
public string Linq() { using Rist <string> list = CreateAndPopulateList(); IEnumerable <string> enumerable = list.Skip(1).Take(3); return(string.Join(", ", enumerable)); }
private static void Main() { using Rist <string> rist = Directory.EnumerateDirectories(".").ToRist(); rist.AddRange(Directory.EnumerateFiles(".")); rist.Sort((left, right) => string.CompareOrdinal(right, left)); foreach (string item in rist) { Console.WriteLine(item); } int count = rist.Count; string[] array = rist.MoveToArray(); int length = array.Length; Debug.Assert(count <= length); Console.WriteLine($"{nameof(count)}: {count}, {nameof(length)}: {length}"); int capacity = rist.Capacity; Debug.Assert(capacity == 0); Console.WriteLine($"{nameof(capacity)}: {capacity}"); }
public void TrimExcess(Rist <int> list) => list.TrimExcess();
public void RemoveRange(Rist <int> list, int index, int count) => list.RemoveRange(index, count);
public void SetCapacity(Rist <int> list, int capacity) => list.Capacity = capacity;
public int GetCapacity(Rist <int> list) => list.Capacity;