FileSystemWatcher.OnChanged(FileSystemEventArgs) FileSystemWatcher.OnChanged(FileSystemEventArgs) FileSystemWatcher.OnChanged(FileSystemEventArgs) FileSystemWatcher.OnChanged(FileSystemEventArgs) Method

定義

引發 Changed 事件。Raises the Changed event.

protected:
 void OnChanged(System::IO::FileSystemEventArgs ^ e);
protected void OnChanged (System.IO.FileSystemEventArgs e);
member this.OnChanged : System.IO.FileSystemEventArgs -> unit
Protected Sub OnChanged (e As FileSystemEventArgs)

參數

備註

OnChanged對受監視目錄中的檔案或目錄進行大小、系統屬性、上次寫入時間、上次存取時間或安全性許可權的變更時,會呼叫。OnChanged is called when changes are made to the size, system attributes, last write time, last access time, or security permissions of a file or directory in the directory being monitored.

使用屬性來限制處理Changed事件時所引發的事件數目。 NotifyFilterUse the NotifyFilter property to restrict the number of events raised when the Changed event is handled.

一旦建立檔案,就會引發事件。OnCreatedThe OnCreated event is raised as soon as a file is created. 如果檔案正在複製或傳輸到監看目錄中,則OnCreated會立即引發事件,後面接著一或多個OnChanged事件。If a file is being copied or transferred into a watched directory, the OnCreated event will be raised immediately, followed by one or more OnChanged events.

引發事件會透過委派叫用此事件處理常式。Raising an event invokes the event handler through a delegate. 如需詳細資訊, 請參閱處理和引發事件For more information, see Handling and Raising Events.

給繼承者的注意事項

在衍生OnChanged(FileSystemEventArgs)類別中覆寫時,請務必呼叫基類的OnChanged(FileSystemEventArgs)方法。When overriding OnChanged(FileSystemEventArgs) in a derived class, be sure to call the base class's OnChanged(FileSystemEventArgs) method.

適用於

另請參閱