title: Enums casting to a byte
body: <p>Am using EntityFramework and have a LinkStatusID column which is a tinyint, which gets generated into a byte in C#.</p>
  
  <pre><code>public enum LinkStatus
  {
      Added = 0,
      Deleted = 1
  }
  </code></pre>
  
  <p>however this gives:</p>
  
  <pre><code>a.LinkStatusID = (byte)Enums.LinkStatus.Deleted;
  </code></pre>
  
  <p>is there a more elegant way to structure this?</p>
  
  <p>EDIT2 for LastCoder:</p>
  
  <pre><code>public enum LinkStatus : byte
  {
      Added = 0,
      Deleted = 1
  }
  
      var blah = Enums.LinkStatus.Added;
      var ty = blah.GetType();
  
      var blah2 = (byte)Enums.LinkStatus.Added;
      var ty2 = blah2.GetType();
  </code></pre>
  
  <p>This doesn't work (as I expected) however the first answer <a href="https://stackoverflow.com/questions/5625873/unable-to-implicitly-convert-value-from-enum-even-though-the-underlying-type-is">here</a> explains why.</p>
  
  <p>EDIT3:
  EF isn't the only way this sln gets to the DB, so I'm keen to keep the Enums explicit in the code.  Thanks for EF5 Enum suggestions!</p>