How would someone detect if an enum has been defined as a bitmask flag, or a series of single case values?
Example:
public enum ElementalType
{
Normal = 0,
Fire = 1,
Frost = 2,
Energy = 3,
Nature = 4,
Sonic = 5,
Arcane = 6,
Shadow = 7,
Holy = 8,
}
Would be detected as a normal single-case enum.
However:
public enum CubeFaceVisibility
{
None = 0,
/// <summary>
/// NegativeZ
/// </summary>
North = 1,
/// <summary>
/// PostiveX
/// </summary>
East = 2,
/// <summary>
/// PostiveZ
/// </summary>
South = 4,
/// <summary>
/// NegativeX
/// </summary>
West = 8,
/// <summary>
/// PositiveY
/// </summary>
Top = 16,
/// <summary>
/// NegativeY
/// </summary>
Bottom = 32,
NorthSouth = North | South,
EastWest = East | West,
TopBottom = Top | Bottom,
NorthEastSouthWest = North | East | South | West,
All = North | South | West | East | Top | Bottom
}
Would be detected as a bitmask style enum.
Does anyone know how to write a function that can determine the culture of enums? I'm tagging this as reflection, but that may be irrelevant to the question.
Aucun commentaire:
Enregistrer un commentaire