Exemple #1
0
            /// <summary>
            /// Exits the current recomposition update.
            /// </summary>
            public void Dispose()
            {
                if (collection != null)
                {
                    Interlocked.Exchange(ref collection.recomposition, null);

                    collection = null;
                }
            }
Exemple #2
0
            /// <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);
                }
            }