HttpStaticObjectsCollection.SyncRoot Property

Definition

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

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

Property Value

Object

当前的 HttpStaticObjectsCollectionThe current HttpStaticObjectsCollection.

Implements

Examples

下面的示例创建一个对象,该对象用于同步对 HttpStaticObjectsCollection的访问。The following example creates an object used to synchronize access to the HttpStaticObjectsCollection.

Object MySyncObject = Application.StaticObjects.SyncRoot;

Dim MySyncObject As Object = Application.StaticObjects.SyncRoot
   

Remarks

通常,程序代码应对集合的 SyncRoot 执行同步操作,而不是直接在集合本身上执行。Program code should generally perform synchronized operations on the SyncRoot of a collection, not directly on the collection itself. 这样可确保对从其他对象派生的集合正确地执行操作。This ensures proper operation of collections that are derived from other objects. 具体而言,它与可能同时修改集合对象的其他线程保持正确的同步。Specifically, it maintains proper synchronization with other threads that might be simultaneously modifying the collection object.

此实现中返回的对象是 HttpStaticObjectsCollection 本身。The object returned in this implementation is the HttpStaticObjectsCollection itself.

Applies to