Enum.GetNames() results in unexpected order with negative enum constants

后端 未结 2 1375
深忆病人
深忆病人 2021-01-08 01:20

I have the following enum definition (in C#):

public enum ELogLevel
{
    General = -1,  // Should only be used in drop-down box in Merlinia Administrator lo         


        
2条回答
  •  不思量自难忘°
    2021-01-08 01:35

    Depending on how the sorting occurs, it may be that it is sorting the values as if they were unsigned, in which case, -1 = 0xffffffff, which is of course greater than 7.

提交回复
热议问题