title: C# BaseType of enum
body: <p>I have a <code>enum Color</code>, it may derive from <code>long</code> or <code>byte</code> or <code>int</code>, and I want to know what type does it really derive from, <code>long</code> or <code>byte</code> or <code>int</code>? In the process, I have met 2 problems.</p>
  
  <p>First, the <code>Color</code> is defined like below:</p>
  
  <pre><code>enum Color : long
  {
      red = 1,
      black = 2,
      blue = 3
  }
  </code></pre>
  
  <h2>Problem 1</h2>
  
  <p>I write the code below to do such things:</p>
  
  <pre><code>Console.WriteLine(typeof(Color));    // ConsoleApp7.Color
  Console.WriteLine(typeof(Color).BaseType);    // System.Enum
  </code></pre>
  
  <p>At this moment, I met my first problem: it's curious that <code>typeof(Color).BaseType</code> is <code>System.Enum</code>, because <code>Color</code> is a <code>enum</code> type. </p>
  
  <p><strong>So I'm wondering that whether you defining a <code>enum</code> type like <code>enum Enum1 { ... }</code>, it actually means that: <code>class Enum1 : enum { ... }</code>?</strong></p>
  
  <h2>Problem 2</h2>
  
  <p>Based on problem 1, if I want to get its <strong>real</strong> base type, I need to write:</p>
  
  <pre><code>Console.WriteLine(typeof(Color).BaseType.BaseType);
  </code></pre>
  
  <p>Its output is <code>System.ValueType</code>, we know that <code>int</code>, <code>byte</code> and <code>long</code> all are <code>System.ValueType</code>, how can I get the keyword <strong>long</strong>?</p>
  
  <p>Thanks.</p>