title: How to compare enum array values and console input?
body: <p>How to check is there a value which user enter from console.</p>
  
  <p>I've got five enum values:</p>
  
  <pre><code>enum Fruits
  {
      apple = 1,
      orange,
      banana,
      chery,
      kiwi
  }
  </code></pre>
  
  <p>And created an array of those values:</p>
  
  <pre><code>Array arrayFruits = Enum.GetValues(typeof(Fruits));
  </code></pre>
  
  <p>The follow code below:</p>
  
  <pre><code>Console.WriteLine("Enter plant");
  string plantNotLow = Console.ReadLine();
  string plant = plantNotLow.ToLower();
  
  object element = Enum.Parse(typeof(Fruits), plant);
  Fruits fruit = (Fruits)element;
  
  Array arrayFruits = Enum.GetValues(typeof(Fruits));
  
  for (int i = 0; i &lt; arrayFruits.Length; i++)
  {
      if(arrayFruits.GetValue(i) == element)
      {
  
      }
  }
  </code></pre>
  
  <p>E.g. user enter "apple", how to enter in if-block?</p>