-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Improve FileSystemWatcher examples #5314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Docs Build status updates of commit ed157b8: ✅ Validation status: passedFor more details, please refer to the build report. Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report. For any questions, please:
|
| Console.WriteLine($"File: {e.FullPath} {e.ChangeType}"); | ||
| private static void OnChanged(object sender, FileSystemEventArgs e) | ||
| { | ||
| if (e.ChangeType != WatcherChangeTypes.Changed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discovered that the OnChanged event method gets called on any change type. The only one I care about in my example is Changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this with .NET Core / .NET 5? I don't think this should be possible with .NET 5.
The Windows, Linux and Mac implementations all raise the Changed event with NotifyFileSystemEventArgs():
adamsitnik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @carlossanlop !
samples/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp
Show resolved
Hide resolved
samples/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp
Show resolved
Hide resolved
|
Docs Build status updates of commit 66494b1: ✅ Validation status: passedFor more details, please refer to the build report. Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report. For any questions, please:
|
|
Looks good now in the preview. |
Like with previous PRs, I am trying to improve our System.IO examples and make sure we only test the relevant code.
I am removing comments too, I felt they were redundant, but if you think a comment would be helpful, let me know.
I ensured they all compiled and executed successfully.