title: How to measure how long IComparer took?
body: <p>Hi I'm currently writing a testing plan for part of my project and I would like to know how to measure how long my sort function takes. My attempt looked like this:</p>
  
  <pre><code>    private void byIGNameToolStripMenuItem_Click(object sender, EventArgs e)
      {
          GameDB.Sort(new PlayerNameComparer());
          currentEntryShown = 0;
          ShowData();
          UpdatePrevNextBtnStatus();
      }
      public class PlayerNameComparer : IComparer
      {
          Stopwatch stopwatch = new Stopwatch();
          stopwatch.Start();
          public int Compare(object x, object y)
          {
              return ((Player)x).playerIgName.CompareTo(((Player)y).playerIgName);
          }
          stopwatch.Stop();
          MessageBox.Show("Time Elapsed:" + stopwatch.ElapsedMilliseconds);
      }
  </code></pre>
  
  <p>But I get a compiler error: <code>'DBProject.Form1.PlayerNameComparer.stopwatch' is a 'field' but is used like a 'type'</code></p>