/// <summary> /// Изменяет текущий объект <see cref="MyHashSet{T}"/> так, чтобы он содержал /// только элементы, которые имеются в этом объекте и в указанной коллекции. /// </summary> /// <param name="other">Коллекция для сравнения с текущим объектом <see cref="MyHashSet{T}"/>.</param> /// <exception cref="ArgumentNullException">Свойство other имеет значение null.</exception> public void IntersectWith(IEnumerable <T> other) { lastModifed = DateTime.Now; MyHashSet <T> toAdd = new MyHashSet <T>(cards.Length); foreach (T oth in other) { if (Contains(oth)) { toAdd.Add(oth); } } cards = toAdd.cards; }
/// <summary> /// Освобождает все ресурсы, используемые <see cref="Enumerator"/> /// объекта. /// </summary> public void Dispose() { myHashSet = null; enumeratorCards = null; enumeratorList = null; }
public Enumerator(MyHashSet <T> myHashSet) : this() { this.myHashSet = myHashSet; this.myLastModifed = myHashSet.lastModifed; }