public IEnumerator <T> GetEnumerator() { foreach (var node in FuncEnumerable <WeakNode> .Get(GetNodeEnumerator)) { T current; if (node.TryGetValue(out current)) { yield return(current); } } }
/// <summary> /// Adds an item to the end of the enumerable. /// </summary> /// <remarks>This method requires the entire collection to be enumerated. /// If adding to the end is not required, use <see cref="Insert"/>. It's faster.</remarks> public void Add(T item) { Contract.Requires <ArgumentNullException>(item != null); var node = new WeakNode(item); var last = FuncEnumerable <WeakNode> .Get(GetNodeEnumerator).LastOrDefault(); if (last == null) { m_head = node; } else { last.Next = node; } }