The below code always orders by the value of the enum
, but I would like to do it by position in the enum
. You noticed Matchup
is third in the enum
but with value of 6. It always comes out of the iteration as last in the list.
foreach (var enumName in Enum.GetValues(enumType).Cast<TEnum>())
{
}
public enum RestrictionDetailType
{
[EnumMember(Value = "0"), Display(Name = "None")]
None = 0,
[EnumMember(Value = "1"), Display(Name = "Team")]
Team = 1,
[EnumMember(Value = "6"), Display(Name = "Matchup")]
Matchup = 6,
[EnumMember(Value = "2"), Display(Name = "Date/Time")]
DateTime = 2,
[EnumMember(Value = "3"), Display(Name = "Venue")]
VenueCourt = 3,
[EnumMember(Value = "4"), Display(Name = "Games")]
Games = 4,
[EnumMember(Value = "5"), Display(Name = "Exhibition")]
Exhibition = 5
}