title: Using enums in generic methods in C#
body: <p>I just started learning C# today, and I am trying to make a generic method which can operate on different enums.  I got some code that I found in another question on paper, but the compiler keeps complaining.  I was wondering if someone could give me a hand.  Here is what I have so far:</p>
  
  <pre><code>    static void ReadMenuInput&lt;T&gt;(out T menuInput)
      {
          while (true)
          {
              if (enum&lt;T&gt;.TryParse(Console.ReadLine(), out menuInput) &amp;&amp; menuInput &lt; sizeof(T))
              {
                  break;
              }
              Console.WriteLine("Please enter a valid input.");
          } 
      }
  </code></pre>
  
  <p>Thank you for your help!</p>