title: how to compare string with enum in C#
body: <pre><code>string strName = "John";
  public enum Name { John,Peter }
  
  private void DoSomething(string myname)
  {
  case1:
       if(myname.Equals(Name.John) //returns false
       {
  
       }
  
  case2:
       if(myname == Name.John) //compilation error
       {
  
       }
  
  case3:
       if(myname.Equals(Name.John.ToString()) //returns true (correct comparision)
       {
  
       }
  }
  </code></pre>
  
  <p>when I use <code>.Equals</code> it is reference compare and when I use <code>==</code> it means value compare. </p>
  
  <p>Is there a better code instead of converting the enum value to <code>ToString()</code> for comparison? because it destroys the purpose of value type enum and also, <code>ToString()</code> on enum is deprecated??</p>