title: How to get enum Key in C# using Enum Value
body: <p>I have 1 string variable, have Enums and need to compare incoming string variable to Enum Values, and if it finds compares, I need to take compared Enum Key and assign to some int variable. How can I do this?
  I need Only Enum Key.</p>
  <p>For Example I have :</p>
  <pre><code>public class Enums
  {
    Admin = 0,
    Seller = 1,
    Member = 2,
    Unknown = 3
  }
  </code></pre>
  <p>And Some base class:</p>
  <pre><code>string tech = “Member”;
  
  foreach(string value in Enum.GetNames(typesof(Enums)))
  {
    If(tech == value)
  {
    int enumValueKey =  And here I need '2'. 
  }}}
  </code></pre>
  <p>In Base class, I have only string type variable for example (string Admin, string Seller, string Member, string Unknown). If It finds 1 comparison , then should write Key in int value , the same value as was found in Enums.</p>
  <p>Thanks a lot</p>