title: Create multiple instances of the same FileSystemWatcher
body: <p>My program needs to monitor multiple locations, but trigger the same code for each location. As a single <code>FileSystemWatcher</code> can't monitor multiple locations, but is it possible to create multiple instances of it and pass in a folder path for each? </p>
  
  <p>I can't hard code each <code>FileSystemWatcher</code> as more and more locations will need to be added in time and this needs to be done by the end users, as it is highly impractical for me to have to manually hard code a new <code>FileSystemWatcher</code> each time. So my plan was to have the folder paths saved to a file and the program just creates a <code>FileSystemWatcher</code> for each path in the list. But I have no idea if this is possible in the slightest. </p>
  
  <p>Going on the Factory Method Pattern suggestion here the attempt:
  I get the errors: "'List' does not contain a definition for 'add'</p>
  
  <pre><code>public void StartWatchers()
      {
          string[] ArrayPaths = new string[2];
          List&lt;FileSystemWatcher&gt; watchers = new List&lt;FileSystemWatcher&gt;();
          ArrayPaths[0] = @"K:\Daily Record Checker\Test\Test1";
          ArrayPaths[1] = @"K:\Daily Record Checker\Test\Test2";
  
          int i = 0;
          foreach (String String in ArrayPaths)
          {
              watcher.add(MyWatcherFatory(ArrayPaths[i]));
              i++;
          }
          //Do other stuff....
          //....
          //Start my watchers...
          foreach (FileSystemWatcher watcher in watchers)
          {
              Watcher.EnableRaisingEvents = true;
              i++;
          }
  
      }
  
      FileSystemWatcher MyWatcherFatory(string path)
      {
          FileSystemWatcher watcher = new FileSystemWatcher(path);
          watcher.Changed += Watcher_Created;
          watcher.Path = path;
          watcher.Filter = "*.csv";
          return watcher;
      }
  
      private void Watcher_Created(object sender, FileSystemEventArgs e)
      {
          System.Threading.Thread.Sleep(1000);
          FileInfo fileInfo = new FileInfo(e.FullPath);
          if (!IsFileLocked(fileInfo))
          {
              CheckNumberOfRecordsInFile(e.FullPath);
          }          
      }
  </code></pre>