コード例 #1
0
 /// <summary>
 /// Returns an enumerator that iterates through the collection.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
 /// </returns>
 public virtual IEnumerator<T> GetEnumerator() {
     LazyList<T> list = this;
     do {
         yield return list.Head;
         list = list.Tail;
     }
     while (!list.IsEmpty);
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LazyList{T}"/> class.
 /// </summary>
 /// <param name="head">The head.</param>
 /// <param name="tail">The tail.</param>
 private LazyList(T head, LazyList<T> tail) {
     _head = head;
     _tail = tail;
 }