How to get right result of ToString() method in enum with two equal items

后端 未结 4 1836
礼貌的吻别
礼貌的吻别 2021-01-26 00:38

I have enum

[Flags]
public enum MyEnum
{
   Item1 = 32768,
   Item2 = 65536,
   Item3 = 524288,
   Item4 = Item3
}

Results of ToString() operat

4条回答
  •  野性不改
    2021-01-26 01:06

    No, because enum aren't collections of strings. They are value types that can contain an integral of a certain type (normally an int), where some of these integrals are connected to a "name" (your Item4)

提交回复
热议问题