title: How can I make something like a dynamic enumeration in C#?
body: <p>In an application I'm building I had an enumeration of account statuses:</p>
  
  <pre><code> public enum AccountStatus
   {
        Active = 1,
        Trial = 2,
        Canceled = 3
   }
  </code></pre>
  
  <p>However, I needed more information from an AccountStatus so I made a class which has a few extra useful properties:</p>
  
  <pre><code> public class AccountStatus
   {
        public int Id {get; set;}
        public string Description {get; set;}
        public bool IsActive {get; set;}
        public bool CanReactivate {get; set;}
   }
  </code></pre>
  
  <p>This class get populated from a database table that might look like this:</p>
  
  <pre><code> 1,  "Active",       True,  True
   2,  "Trial",        True,  True 
   3,  "ExpiredTrial", False, True
   4,  "Expelled",     False, False
  </code></pre>
  
  <p>This is really handy when I have a customer object that uses the AccountStatus because I can write code like:</p>
  
  <pre><code> if(customer.Status.CanReactivate) // Show reactivation form
  </code></pre>
  
  <p>However, I have lost something equally important.  I can no longer do this:</p>
  
  <pre><code> if(customer.Status == AccountStatus.Active)  // allow some stuff to happen
  </code></pre>
  
  <p>What would be the best way, if its even possible, to include something that will allow me to mimic the enumeration within the class.  I know that I could add public static fields to the AccountStatus class, but ultimately this doesn't work because if the database changes the code would have to be manually updated.  By this, I mean:</p>
  
  <pre><code> public static readonly AccountStatus Active = new AccountStatus(1);
   public static readonly AccountStatus Trial = new AccountStatus(2);
   // etc, etc ...
  </code></pre>
  
  <p>I imagine there is probably a pattern for this somewhere, I just don't know what its called.</p>
  
  <p>Any ideas?</p>
  
  <p><strong><em>CLARIFICATION</em></strong></p>
  
  <p>Based on the answers so far I need to clarify a couple of things.</p>
  
  <p>The table above is a brief example.  In my actual table there a many records, I have 12 in there right now.  Plus we can add more or remove some existing.  This is what I meant by "dynamic" in my question title.</p>
  
  <p>Secondly, I gave a very simple use case for the ability I lost which apparently confused matters.  Here is another real example:</p>
  
  <pre><code> if(customer.Status == AccountStatus.Trial || customer.Status == AccountStatus.ExpiredTrial)
  </code></pre>
  
  <p>... neither Trial nor ExpiredTrial are boolean values on the property.  I don't want to add them either.  That would set an even worse precedent than the one I'm trying to avoid (meaning I would have to add a new property to the class every time I added a new record to the table).</p>
  
  <p><strong><em>UPDATE</em></strong></p>
  
  <p>I selected an answer which didn't really meet was I was looking for, but suggests that I was looking for something unnecessary. After thinking about this, I concur.  While adding an enum or static fields does duplicate some work (ie, having the values in both code and in a table) I think the benefits outweigh the negatives.</p>