TimerEventSubscriptionCollection.SyncRoot Propriedade

Definição

Obtém um objeto que pode ser usado para sincronizar o acesso ao TimerEventSubscriptionCollection.Gets an object that can be used to synchronize access to the TimerEventSubscriptionCollection.

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

Valor da propriedade

Object

Um objeto usado para sincronizar o acesso ao TimerEventSubscriptionCollection .An object used to synchronize access to the TimerEventSubscriptionCollection.

Implementações

Comentários

SyncRoot Retorna um objeto, que pode ser usado para sincronizar o acesso ao TimerEventSubscriptionCollection .SyncRoot returns an object, which can be used to synchronize access to the TimerEventSubscriptionCollection.

O acesso ao TimerEventSubscriptionCollection é sincronizado; no entanto, a enumeração por meio de uma coleção é intrinsecamente não um procedimento de thread seguro.Access to the TimerEventSubscriptionCollection is synchronized; however, enumerating through a collection is intrinsically not a thread safe procedure. Mesmo quando uma coleção está sincronizada, outros threads ainda podem modificar a coleção, o que faz o enumerador lançar uma exceção.Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. Para garantir a segurança do thread durante a enumeração, você pode bloquear o TimerEventSubscriptionCollection durante toda a enumeração usando SyncRoot ou capturar as exceções resultantes de alterações feitas por outros threads.To guarantee thread safety during enumeration, you can either lock the TimerEventSubscriptionCollection during the entire enumeration by using SyncRoot or catch the exceptions resulting from changes made by other threads.

Aplica-se a