예제 #1
0
        public string Copy()
        {
            using Rist <string> list = CreateAndPopulateList();

            string[] array = list.ToArray();
            return(string.Join(", ", array, 1, 3));
        }
예제 #2
0
        public string Linq()
        {
            using Rist <string> list = CreateAndPopulateList();

            IEnumerable <string> enumerable = list.Skip(1).Take(3);

            return(string.Join(", ", enumerable));
        }
예제 #3
0
파일: Program.cs 프로젝트: qbit86/misnomer
        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}");
        }
예제 #4
0
 public void TrimExcess(Rist <int> list) => list.TrimExcess();
예제 #5
0
 public void RemoveRange(Rist <int> list, int index, int count) => list.RemoveRange(index, count);
예제 #6
0
 public void SetCapacity(Rist <int> list, int capacity) => list.Capacity = capacity;
예제 #7
0
 public int GetCapacity(Rist <int> list) => list.Capacity;