Condividi tramite


FileSystemWatcher.SynchronizingObject Proprietà

Definizione

Ottiene o imposta l'oggetto utilizzato per effettuare il marshalling delle chiamate del gestore eventi rilasciate in seguito a una modifica della directory.

public:
 property System::ComponentModel::ISynchronizeInvoke ^ SynchronizingObject { System::ComponentModel::ISynchronizeInvoke ^ get(); void set(System::ComponentModel::ISynchronizeInvoke ^ value); };
public System.ComponentModel.ISynchronizeInvoke? SynchronizingObject { get; set; }
public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get; set; }
[System.IO.IODescription("FSW_SynchronizingObject")]
public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get; set; }
[System.IO.IODescription("FSW_SynchronizingObject")]
[System.ComponentModel.Browsable(false)]
public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get; set; }
[System.ComponentModel.Browsable(false)]
public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get; set; }
member this.SynchronizingObject : System.ComponentModel.ISynchronizeInvoke with get, set
[<System.IO.IODescription("FSW_SynchronizingObject")>]
member this.SynchronizingObject : System.ComponentModel.ISynchronizeInvoke with get, set
[<System.IO.IODescription("FSW_SynchronizingObject")>]
[<System.ComponentModel.Browsable(false)>]
member this.SynchronizingObject : System.ComponentModel.ISynchronizeInvoke with get, set
[<System.ComponentModel.Browsable(false)>]
member this.SynchronizingObject : System.ComponentModel.ISynchronizeInvoke with get, set
Public Property SynchronizingObject As ISynchronizeInvoke

Valore della proprietà

Oggetto ISynchronizeInvoke che rappresenta l'oggetto utilizzato per effettuare il marshalling delle chiamate del gestore eventi rilasciate in seguito a una modifica della directory. Il valore predefinito è null.

Attributi

Commenti

Quando SynchronizingObject è null, i metodi che gestiscono gli Changedeventi , CreatedDeleted, e Renamed vengono chiamati su un thread dal pool di thread di sistema. Per altre informazioni sui pool di thread di sistema, vedere ThreadPool.

Quando gli Changedeventi , Created, Deletede Renamed vengono gestiti da un componente Visual Windows Form, ad esempio un Buttonoggetto , l'accesso al componente tramite il pool di thread di sistema potrebbe non funzionare o potrebbe causare un'eccezione. Evitare questo problema impostando SynchronizingObject su un componente Windows Form, che determina la chiamata dei metodi che gestiscono gli Changedeventi , CreatedDeleted, e Renamed nello stesso thread in cui è stato creato il componente.

Se l'oggetto FileSystemWatcher viene utilizzato all'interno di Visual Studio 2005 in una finestra di progettazione di Windows Form, SynchronizingObject imposta automaticamente sul controllo che contiene .FileSystemWatcher Ad esempio, se si inserisce un oggetto FileSystemWatcher in una finestra di progettazione per Form1 (che eredita da Form) la SynchronizingObject proprietà di FileSystemWatcher viene impostata sull'istanza di Form1.

Si applica a

Vedi anche