What's the best way in code to 开发者_StackOverflowcompare enum values? For example, if I have the following enum type:
public enum Level : short {
    Low,   
    FairlyLow,
    QuiteLow,
    NotReallyLow,
    GettingHigh,
    PrettyHigh,
    High,
    VeryHigh,
}
And I want to be able to write statements such as:
from v in values select v where v > Level.QuiteLow
You need to cast the enum value to its numeric value, because enum values aren't comparable :
from v in values where (short)v > (short)Level.QuiteLow select v
EDIT: actually this is not true : enum values are comparable, so this code works fine :
from v in values where v > Level.QuiteLow select v
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论