Search

Categories

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Send mail to the author(s) E-mail

# Friday, March 04, 2011

“..enums a great way to declare a variable of a type that can be one of a fixed set of values.”

http://geekswithblogs.net/BlackRabbitCoder/archive/2010/07/08/c-fundamentals-the-joys-and-pitfalls-of-enums.aspx

public enum ProductionStudio { MGM, Paramount, Universal, Pixar, Disney, Dreamworks};


public class ProductionStudio
{
public static readonly ProductionStudio MGM = new ProductionStudio();
public static readonly ProductionStudio Paramount = new ProductionStudio();
public static readonly ProductionStudio Universal = new ProductionStudio();
public static readonly ProductionStudio Pixar = new ProductionStudio();
public static readonly ProductionStudio Disney = new ProductionStudio();
public static readonly ProductionStudio Dreamworks = new ProductionStudio();
}

In some situations you may want to use public static readonly… a constant really.  Gives intellisense.

All comments require the approval of the site owner before being displayed.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview