How can I get the number of items defined in an enum?
If you find yourself writing the above solution as often as I do then you could implement it as a generic:
public static int GetEnumEntries() where T : struct, IConvertible
{
if (!typeof(T).IsEnum)
throw new ArgumentException("T must be an enumerated type");
return Enum.GetNames(typeof(T)).Length;
}