public void CopyTo(T[] array, int arrayIndex) { if (array == null) { throw new ArgumentNullException(nameof(array)); } if (array.GetLowerBound(0) != 0) { throw new ArgumentException("Non zero lower bound"); } if (arrayIndex < 0) { throw new ArgumentOutOfRangeException(); } if (array.Length - arrayIndex < Count) { throw new ArgumentException(); } var items = TraversalStrategy.Traversal(Head); while (items.MoveNext()) { array[arrayIndex++] = items.Current; } }
public static string TraversalStrategyToString(TraversalStrategy strategy) { switch (strategy) { case TraversalStrategy.BreadthFirst: return("breadthfirst"); case TraversalStrategy.DepthFirst: return("depthfirst"); default: throw new InvalidOperationException($"TraversalStrategy {strategy} binding not found, this is a client bug"); } }
public IEnumerator <T> GetEnumerator() { return(TraversalStrategy.Traversal(Head)); }