枚举

it2025-04-05  15

public  enum testenum

{

      aa,

      bb,

      cc,

     dd

};//遍历枚举foreach (testenum item in Enum.GetValues(typeof(testenum))){}Enum.GetValues(typeof(枚举的名称));可以获得指定枚举的枚举值。Enum.GetNames(typeof(枚举的名称));可以获得指定枚举的枚举名称。

转载于:https://www.cnblogs.com/lhlong/p/5013260.html

最新回复(0)