title: How to implement filewatcher using Reactive extensions
body: <p>I am new to Rx and looking to use it in my current project. I am trying to implement a file watcher system. Atleast for now I am only interested in file Creation event. But I am getting "Value cannot be null error message" when trying to run below code. 
  Please could someone help me out with below code.</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          IDisposable writer = new FileSystemObservable(@"D:\Code\Rx\Dropbox\", "*.*", false)
                              .CreatedFiles
                              .Where(x =&gt; (new FileInfo(x.FullPath)).Length &gt; 0)
                              .Select(x =&gt; x.Name)
                              .Subscribe(Console.WriteLine);
          Console.ReadLine();
      }
  }
  
  
  class FileSystemObservable
  {
      private readonly FileSystemWatcher fileSystemWatcher;
  
      public FileSystemObservable(string directory, string filter, bool includeSubdirectories)
      {
          fileSystemWatcher = new FileSystemWatcher(directory, filter)
              {
                  EnableRaisingEvents = true,
                  IncludeSubdirectories = includeSubdirectories
              };
  
          CreatedFiles = Observable.FromEventPattern&lt;FileSystemEventHandler, FileSystemEventArgs&gt;
                  (h =&gt; fileSystemWatcher.Created += h,
                  h =&gt; fileSystemWatcher.Created -= h)
                  .Select(x =&gt; new { x.EventArgs }) as IObservable&lt;FileSystemEventArgs&gt;;
  
          Errors = Observable.FromEventPattern&lt;ErrorEventHandler, ErrorEventArgs&gt;
                  (h =&gt; fileSystemWatcher.Error += h,
                  h =&gt; fileSystemWatcher.Error -= h)
                  .Select(x =&gt; new { x.EventArgs }) as IObservable&lt;ErrorEventArgs&gt;;
      }
  
      public IObservable&lt;ErrorEventArgs&gt; Errors { get; private set; }
  
      public IObservable&lt;FileSystemEventArgs&gt; CreatedFiles { get; private set; }
  }
  </code></pre>