例 次の例では、 をFileSystemWatcher作成して、実行時に指定されたディレクトリをwatchします。 コンポーネントは、ディレクトリ内のテキスト ファイルのLastWriteLastAccess変更、作成、削除、または名前変更をwatchに設定されます。 ファイルが変更、作成、または削除されると、ファイルへのパスがコンソールに出力されます。 ファイルの名前が変更されると、古いパスと新しいパスがコンソールに出力されます。 #include "pch.h" using namespace System; using namespace System::IO; class MyClassCPP { public: int static Run() { FileSystemWatcher^ watcher = gcnew FileSystemWatcher("C:\\path\\to