E
emailtonitin
I am facing a design issue in my code related to the
filesystemwatcher's filter property.
I figured out that the filter won't accept multiple patterns for eg.
"*.txt, *.csv" don't work.
To workaround this issue, I have 2 options:
1. To create multiple instances of filesystemwatcher class and hook all
of them to the same event handlers.
2. To use 1 instance of filesystemwatcher to listen to all files using
blank filter. And in the event handler sort out the files that I need.
for eg. If (filename.endswith("*.txt") || filename.endswith("*.csv"))
//do stuff
My question is which approach is going to be more efficient, provided:
The list of file extensions that I need to watch are configurable (are
subject to change/number of extensions to be watched may go up)
Want to know your thoughts before deciding eitherway.
Thanks,
Nitin
filesystemwatcher's filter property.
I figured out that the filter won't accept multiple patterns for eg.
"*.txt, *.csv" don't work.
To workaround this issue, I have 2 options:
1. To create multiple instances of filesystemwatcher class and hook all
of them to the same event handlers.
2. To use 1 instance of filesystemwatcher to listen to all files using
blank filter. And in the event handler sort out the files that I need.
for eg. If (filename.endswith("*.txt") || filename.endswith("*.csv"))
//do stuff
My question is which approach is going to be more efficient, provided:
The list of file extensions that I need to watch are configurable (are
subject to change/number of extensions to be watched may go up)
Want to know your thoughts before deciding eitherway.
Thanks,
Nitin