Thursday, February 25, 2010

Stop the hard-coding!

I often use lookup values for various conditions, and have to check for those conditions in my code in order to perform some action. Welcome the enum:

strControlType = ((enmControlType)int.Parse(drTempDataRow["ControlTypeID"].ToString()));
switch (strControlType)
case enmControlType.ListBox:
..some action..

Short but sweet...

No comments:

Post a Comment


You May Like This