枚举如何遍历绑定获取为列表
[Description("合作类型")]
public enum GenreType
{
[Description("异地调查")]
OtherArea = 1,
[Description("请教问题")]
AskQuestion = 2,
}
List<object> list = new List<object>(); foreach (StateEnum.GenreType k in Enum.GetValues(typeof(StateEnum.GenreType))) { list.Add(new { Kay=(int)k, Value = k.GetDescription() }); } if (list != null && list.Count > 0) return new Entity.ResultObj(true, list); else return new Entity.ResultObj(true);