I am working with the FileSystemWatcher and need some help. I am trying to monitor multiple files within a directory. What I want to do is for each file that gets changed, create an object to monitor the changes and log those results. My first question is how do I create an unknown number of objects dynamically without them falling out of scope? Do I need an array of objects to do this?
My second question will probably be answered with the first, but I want each child object to be able to raise an event on the Parent object for logging the information. How do I create an event that will be called by an unknown number of child objects?
Flow Chart so far:
1. Monitor the directory with FileSystemWatcher
2. If a file gets created, call the event CreateMonitorObject
3. In CreateMonitorObject event, create a new object to monitor file that is being changed. Multiple objects need to be created for each file being changed
4. All files that get changed should have the MonitorObject raise an event of the Parent to log to a single file location.
I have steps 1 and 2 done, but 3 is the problem.