FileSystemWatcher.SynchronizingObject 屬性

定義

取得或設定物件,用以封送處理因目錄變更而發出的事件處理常式呼叫。

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

屬性值

ISynchronizeInvoke,代表用以封送處理因目錄變更而發出的事件處理常式呼叫的物件。 預設為 null

屬性

備註

當 是 nullSynchronizingObject,會從系統線程集區在線程上呼叫處理 ChangedCreatedDeletedRenamed 事件的方法。 如需系統線程集區的詳細資訊,請參閱 ThreadPool

Changed當 、CreatedDeletedRenamed 事件由視覺效果 Windows Forms元件處理時,例如 Button,透過系統線程集區存取元件可能無法運作,或可能會導致例外狀況。 藉由將 設定SynchronizingObject為 Windows Forms元件來避免這種情況,這會導致處理ChangedCreatedDeletedRenamed 事件的方法在建立元件的相同線程上呼叫。

FileSystemWatcher如果在 Windows Forms 設計工具的 Visual Studio 2005 內使用 ,SynchronizingObject則會自動設定為包含的FileSystemWatcher控件。 例如,如果您在 Form (1 的設計工具上放置 , FileSystemWatcher 其繼承自 Form) SynchronizingObject 的 屬性 FileSystemWatcher 會設定為 Form1 的實例。

適用於

另請參閱