title: Enum to dictionary
body: <p>I want to implement an extension method which converts an enum to a dictionary:</p>
  <pre><code>public static Dictionary&lt;int, string&gt; ToDictionary(this Enum @enum)
  {
      Type type1 = @enum.GetType();
      return Enum.GetValues(type1).Cast&lt;type1&gt;()
          //.OfType&lt;typeof(@enum)&gt;()
          .ToDictionary(e =&gt; Enum.GetName(@enum.GetType(), e));
  }
  </code></pre>
  <p>Why it doesn't compile?</p>
  <p>An error:</p>
  <blockquote>
  <p>&quot;The type or namespace name 'type1'
  could not be found (are you missing a
  using directive or an assembly
  reference?)&quot;</p>
  </blockquote>