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); } }
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); } }
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; }