SiteMapNodeCollection.SyncRoot 属性

定义

获取可用于同步对集合的访问的对象。Gets an object that can be used to synchronize access to the collection.

public:
 virtual property System::Object ^ SyncRoot { System::Object ^ get(); };
public virtual object SyncRoot { get; }
member this.SyncRoot : obj
Public Overridable ReadOnly Property SyncRoot As Object

属性值

Object

用于同步对 SiteMapNodeCollection 的访问的对象。An object that can be used to synchronize access to the SiteMapNodeCollection.

注解

枚举 SiteMapNodeCollection 集合本质上不是线程安全的过程。Enumerating through a SiteMapNodeCollection collection is intrinsically not a thread safe procedure. 即使在 SiteMapNodeCollection 同步时,其他线程仍可以修改 SiteMapNodeCollection ,这会导致枚举器引发异常。Even when a SiteMapNodeCollection is synchronized, other threads can still modify the SiteMapNodeCollection, which causes the enumerator to throw an exception. 若要保证枚举过程中的线程安全性,可以 SiteMapNodeCollection 在整个枚举期间锁定,也可以捕获由其他线程进行的更改所导致的异常。To guarantee thread safety during enumeration, you can either lock the SiteMapNodeCollection during the entire enumeration or catch the exceptions resulting from changes that are made by other threads.

适用于

另请参阅