title: Blazor WebAssembly pass enum as parameter to component
body: <p>I'm creating a Blazor WebAssembly app, I have an enum I'd like to pass as parameter to my Blazor component like this</p>
  <pre><code>public enum EMenu
  {
      Menu1 = 1,
      Menu2 = 2,
      Menu3 = 3,
  }
  
  [Parameter] public EMenu Id { get; set; }
  
  &lt;NavMenu id=&quot;menu1&quot; /&gt;
  </code></pre>
  <p>The <code>EMenu</code> is my enum, <code>Id</code> is my parameter on my <code>NavMenu</code> component. But it errors out with <code>Specified cast is not valid</code> message.</p>
  <p>I googled and saw this GitHub issue <a href="https://github.com/dotnet/aspnetcore/issues/19139" rel="nofollow noreferrer">https://github.com/dotnet/aspnetcore/issues/19139</a> and according to it the following should work when you prefix the enum value with your enum name</p>
  <pre><code>&lt;NavMenu id=&quot;EMenu.Menu1&quot; /&gt;
  </code></pre>
  <p>But it did not work for me, same error. Could someone help point out what's wrong?</p>