c#枚举型遍历

public enum eErrorDetailCode : int {  登陆成功 = 0,  登出 = 1,  应用错误 = 2,  成功 = 16,  失败 = 17 }

foreach (

  int intError in Enum.GetValues(typeof(eErrorDetailCode))) {    

  strKey = intError.ToString();    

  strValue = Enum.GetName(typeof(eErrorDetailCode), intError);

}

原文地址:https://www.cnblogs.com/yufan27209/p/4038356.html