Share via


ObservableCollection<T>.BlockReentrancy 方法

定義

不允許變更這個集合的可重新進入嘗試。

protected:
 IDisposable ^ BlockReentrancy();
protected IDisposable BlockReentrancy ();
member this.BlockReentrancy : unit -> IDisposable
Protected Function BlockReentrancy () As IDisposable

傳回

IDisposable 物件,可用來處置物件。

範例

典型的用法是在範圍內包裝 OnCollectionChanged 呼叫 using ,如下列範例所示:

using (BlockReentrancy())
{
    // OnCollectionChanged call
}
Using BlockReentrancy()
    ' OnCollectionChanged call
End Using

適用於

另請參閱