var levelList = EnumEx.GetIntValues(CarConst.CustomCarType.Bus.GetType()); foreach (var level in levelList) { var en = (CarConst.CustomCarType)level; var leveldescript = ((en).GetAttribute<DescriptionAttribute>()).Description; <option value="@level">@leveldescript</option> }
原文:http://www.cnblogs.com/llxy/p/4187331.html