Home » 2013 » October

CSharp Enum

tp_vol4_002 It is often tempting when working with your code to test against static values in your system.  For example:

if (i == 1)
{
    // do something
}
else if (i == 2)
{
    // do something
}

Or, if you are a bit more clever, you use a switch statement instead.  But neither of these methods tell you what 1 and 2 actually represent. Continue reading “CSharp Enum”