private static LinkedContainer <int> CreateLinkedContainer(int[] array)
        {
            var collection = new LinkedContainer <int>();

            foreach (var item in array)
            {
                collection.Add(item);                         // this adds to front
            }
            return(collection);
        }
        public void LinkedContainer(int[] array)
        {
            LinkedContainer <int> collection = CreateLinkedContainer(array);

            SequencePosition position = default;
            int arrayIndex            = array.Length;

            while (collection.TryGet(ref position, out int item))
            {
                Assert.Equal(array[--arrayIndex], item);
            }
        }
Exemple #3
0
        public void LinkedContainer(int[] array)
        {
            LinkedContainer <int> collection = CreateLinkedContainer(array);

            var position   = Position.First;
            int arrayIndex = array.Length;
            int item;

            while (collection.TryGet(ref position, out item, advance: true))
            {
                Assert.Equal(array[--arrayIndex], item);
            }
        }
Exemple #4
0
 private static LinkedContainer<int> CreateLinkedContainer(int[] array)
 {
     var collection = new LinkedContainer<int>();
     foreach (var item in array) collection.Add(item); // this adds to front
     return collection;
 }