title: Helper class for performance tests using StopWatch class
body: <p>In this example code i am using a simple StopWatch to test time that it takes to complete a given task/action</p>
  
  <pre><code>StopWatch SW1 = new StopWatch();
  SW1.Start();
  SomeAction();
  SW1.Stop();
  sting results = SW1.Elapsed.ToString();
  MessageBox.Show(resutls);
  </code></pre>
  
  <p>i would like to have a class that i will instantiate to use with tests </p>
  
  <pre><code>public Class PerformanceTests
  {
     public StopWatch SW1 = new StopWatch();
     public StopWatch SW2 = new StopWatch();
     public string results1 = "", results2 = "";
     ....
     ....
     //some other variables to use 
  }
  </code></pre>
  
  <p>though when instantiating the class and trying to use <code>SW1</code> is not letting me use its methods. What am i doing wrong ?</p>
  
  <pre><code>PerformanceTests Ptst = new PerformanceTests();
  Ptst.SW1. ... Start() is not accessible
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>For rest of answers, don't copy the code from me, as I miss capitalized <code>stopwatch</code>. Instead of instantiating the Stopwatch class i accidentally didn't pay attention Visual Studio asking if i want to create a class for my so called stopwatch instead of .NET's real <code>Stopwatch</code>.</p>
  
  <p>So my advice, pay attention to the suggested actions of Visual Studio intellisense 
  even though it should be same all the time . Just make sure till you're really experienced and know all the classes by heart.</p>