/// <summary>Returns the stackitems in order from top to bottom.</summary> public IEnumerator <T> GetEnumerator() { for (ImmutableStackCollection <T> p = this; p != null; p = p.Remainder) { yield return(p.TopItem); } }
/// <summary>Construct a new instance by Push-ing <paramref name="item"/> onto <paramref name="remainder"/>.</summary> private ImmutableStackCollection(T item, ImmutableStackCollection <T> remainder) { TopItem = item; Remainder = remainder; }
/// <summary>TODO</summary> protected ImmutableStackCollection(T topItem, ImmutableStackCollection <T> remainder) { TopItem = topItem; Remainder = remainder; }