title: How to dynamically switch between comparing Less Than, Greater Than, or Equal To?
body: <p>Basically I am giving the user an option to filter a set of files based on thier size.</p>
  
  <p>The user picks a comparison type (Greater Than, Less Than, Equal To) from a drop down list, and then enters a size, in bytes, to compare to.  This is what I have so far:</p>
  
  <pre><code>switch (cmboCompareType.SelectedText)
  {
      case "Greater Than":
          fileOK = fi[i].Length &gt; int.Parse(txtByteValue.Text);
          break;
      case "Less Than":
          fileOK = fi[i].Length &lt; int.Parse(txtByteValue.Text);
          break;
      case "Equal To":
          fileOK = fi[i].Length == int.Parse(txtByteValue.Text);
          break;
  }
  </code></pre>
  
  <p>Is there a more elegant way to do this sort of comparison without repeating so much code in C#?</p>