FileSystemWatcher.SynchronizingObject 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定物件,用以封送處理因目錄變更而發出的事件處理常式呼叫。
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; }
[System.ComponentModel.Browsable(false)]
[System.IO.IODescription("The object used to marshal the event handler calls resulting from a directory change")]
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
[<System.ComponentModel.Browsable(false)>]
[<System.IO.IODescription("The object used to marshal the event handler calls resulting from a directory change")>]
member this.SynchronizingObject : System.ComponentModel.ISynchronizeInvoke with get, set
Public Property SynchronizingObject As ISynchronizeInvoke
屬性值
ISynchronizeInvoke,代表用以封送處理因目錄變更而發出的事件處理常式呼叫的物件。 預設為 null
。
- 屬性
備註
當 是 null
時 SynchronizingObject ,會從系統執行緒集區線上程上呼叫處理 Changed 、 Created 、 Deleted 和 Renamed 事件的方法。 如需系統執行緒集區的詳細資訊,請參閱 ThreadPool 。
Changed當 、 Created 、 Deleted 和 Renamed 事件由視覺效果Windows Forms元件處理時,例如 Button ,透過系統執行緒集區存取元件可能無法運作,或可能會導致例外狀況。 藉由將 設定 SynchronizingObject 為 Windows Forms 元件來避免這種情況,這會導致處理 Changed 、 Created 、 Deleted 和 Renamed 事件的方法在建立元件的相同執行緒上呼叫。
FileSystemWatcher如果在Windows Forms設計工具的 Visual Studio 2005 內使用 , SynchronizingObject 則會自動將 設定為包含 的 FileSystemWatcher 控制項。 例如,如果您在 Form (1 的設計工具上放置 , FileSystemWatcher 其繼承自 Form) SynchronizingObject 的 屬性 FileSystemWatcher 會設定為 Form1 的實例。
適用於
另請參閱
意見反應
提交並檢視相關的意見反應