Difference between Enum.GetValues and Enum.GetNames

后端 未结 3 920
故里飘歌
故里飘歌 2020-12-16 13:48

I see the Enum.GetValues returns base Array type and Enum.GetNames returns a string array. But I don\'t understand how th

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-16 14:15

    GetValues will return an Array of the underlying integer values for each item in the Enum.

    GetNames will return a string array of the Names for the items in the enum.

    The Array returned by GetValues implements IList while the string[] returned by GetNames does not, which explains the binding differences.

提交回复
热议问题