title: How do I get global visibility of variables
body: <p>I have a class which contains an another class object which in turn
  create event handlers.</p>
  <p>I need to run some code in the parent class if the event handlers are triggered. How could I solve my problem?</p>
  <pre><code>static class Program
  {
      [STAThread]
      static void Main()
      {
          Application.EnableVisualStyles();
          Application.SetCompatibleTextRenderingDefault(false);
          Application.Run(new windowsform1());
      }
  }
  
  public partial class windowsform1 : Form
  {
      private filewatcher watcher;
  
      private void button_klick(object sender, EventArgs e)
      {
           watcher = new filewatcher(textbox.Text);
      }
  }
  
  public class filewatcher
  {
      [PermissionSet(SecurityAction.Demand, Name = &quot;FullTrust&quot;)]
      public filewatcher(string pfad)
      {
          //... some more code
              watcher.Created += OnChanged;
  
              // Begin watching.
              watcher.EnableRaisingEvents = true;
          }
      }
  
      //event file changed
      private static void OnChanged(object source, FileSystemEventArgs e)
      {
          //Do some stuff with the windowsform1-object in the main thread
      }
  }
  </code></pre>