FileSystemWatcher.SynchronizingObject Proprietà

Definizione

Ottiene o imposta l'oggetto usato per effettuare il marshalling delle chiamate del gestore eventi eseguite in seguito alla modifica di una 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 usato per effettuare il marshalling delle chiamate del gestore eventi eseguite 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 Windows Forms visuale, ad esempio , Buttonl'accesso al componente tramite il pool di thread di sistema potrebbe non funzionare o potrebbe causare un'eccezione. Evitare questo problema impostando SynchronizingObject un componente Windows Forms, che fa sì che i metodi che gestiscono gli Changedeventi , Created, Deletede Renamed vengano chiamati sullo 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 Windows Forms, SynchronizingObject imposta automaticamente sul controllo che contiene l'oggetto 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