title: Running from class in LinqPad
body: <p>How can I run the code below in LinqPad as <strong>C# Program</strong>  Thank you...</p>
  
  <pre><code>class ThreadTest
  {
      bool done;
  
      static void Main()
      {
          ThreadTest tt = new ThreadTest();   // Create a common instance
          new Thread (tt.Go).Start();
          tt.Go();
      }
  
      // Note that Go is now an instance method
      void Go() 
      {
          if (!done) { done = true; Console.WriteLine ("Done"); }
      }
  }
  </code></pre>
  
  <blockquote>
    <p><strong>UPDATE</strong></p>
    
    <p>This sample - along with all the others in the concurrency chapters of C# 5 in a Nutshell are downloadable as a LINQPad sample library. Go to LINQPad's samples TreeView and click 'Download/Import more samples' and choose the first listing. – Joe Albahari</p>
  </blockquote>