forum

Home / DeveloperSection / Forums / Sort enums in declaration order

Sort enums in declaration order

Manoj Bhatt 1917 14-Aug-2014
public enum CurrencyId
{
    USD = 840,
    UAH = 980,
    RUR = 643,
    EUR = 978,
    KZT = 398,
    UNSUPPORTED = 0
}

Is there any way to sort results of Enum.GetValues(typeof(CurrencyId)).Cast<CurrencyId>() by order they are declared in .cs file (USD, UAH, RUR, EUR, KZT, UNSUPPORTED), not by their underlying code? Personally, I believe the answer is 'no', because original order is lost in binaries, so... how can I implement the task?


c# c# 
Updated on 14-Aug-2014

Can you answer this question?


Answer

1 Answers

Liked By