How to assign string values to enums and use that value in a switch

后端 未结 10 1650
小鲜肉
小鲜肉 2021-02-02 10:45

Basically a series of titles will be passed into the switch statement and I need to compare them against the string values of the enum. But I have little to no idea how to do th

10条回答
  •  臣服心动
    2021-02-02 10:59

    Enumerations cannot be of string type.

    The approved types for an enum are byte, sbyte, short, ushort, int, uint, long, or ulong.

    http://msdn.microsoft.com/en-us/library/sbbt4032.aspx

提交回复
热议问题