title: How to compare enum and int values?
body: <pre><code>enum MyEnum
  {
      Invalid=0,
      Value1=1,
      Value1=2,
  }
  
  void main ()
  {
      MyEnum e1 = MyEnum.Value1;
      int i1 = 2;
  
      // Is there any difference how to compare enumEration values with integers?
      if ( e1==(MyEnum)i1 )... // 1st
  
      if ( (int)e1==i1 )... // 2nd
  </code></pre>
  
  <p>In each of mentioned cases we have convertion of enum to int or int to enum.</p>
  
  <p>Is there any difference in these conversions (performance, any other)? Or they are exactly the same?</p>
  
  <p>Thanks.</p>
  
  <p>P.S. In current example I compare to 'magic number' but in real application I am getting data from integer field from DB.</p>