/// <summary> /// Exits the current recomposition update. /// </summary> public void Dispose() { if (collection != null) { Interlocked.Exchange(ref collection.recomposition, null); collection = null; } }
/// <summary> /// Initializes a new instance of the <see cref="Recomposition"/> class. /// </summary> /// <param name="collection">The underlying collection.</param> internal Recomposition(RecomposableCollection <T> collection) { this.collection = collection; if (Interlocked.CompareExchange(ref collection.recomposition, this, null) != null) { throw new InvalidOperationException(Strings.CollectionRecomposing); } }