Apologies if this question is too simple, I am new to the subject.
I am creating a few files, and need to wait until they are completed OR until some period of time has elapsed (this is what I call the timeout).
FileSystemWatcher is perfect for "wait until they are completed", but I cannot see a parameter that would govern its life span.
Using Tread.Sleep seems to defeat the purpose (?) - if its usage were correct, FileSystemWatcher would not exist, we would just Tread.Sleep while !File.Exists.
So, what is the easiest right way to implement it? Thanks.
FileSystemWatcher.WaitForChanged Method
MSDN syas
A synchronous method that returns a structure that contains specific information on the change that occurred, given the type of change you want to monitor and the time (in milliseconds) to wait before timing out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With