Reputation: 6022
I am trying to subclass the FileSystemWatcher to intercept the Created event and delay it until I am able to get a handle on the file. Typical scenario. Am I wrong or there is no way of doing this without introducing my own SafeCreated event? Meaning I don't see a way to override the OnCreated method that is responsible for raising the Created event. Without overriding it I only have the event itself at my disposal, which is no good because the outside world could simply subscribe to that event as well. What am I missing?
Either I'm missing something or I need to be going down the composition route as opposed to inheritance.
Upvotes: 2
Views: 471
Reputation: 61437
You need to use composition as you can't override the method. However, getting access to the file isn't in the feature scope of the FileSystemWacher
, it just monitors changes. Take care of the getting the handle in your own code.
Upvotes: 1