use*_*331 10 c# asp.net asp.net-mvc
我有这样一个公众enum:
public enum occupancyTimeline
{
    TwelveMonths,
    FourteenMonths,
    SixteenMonths,
    EighteenMonths
}
我将用于这样的DropDown菜单:
@Html.DropDownListFor(model => model.occupancyTimeline, 
   new SelectList(Enum.GetValues(typeof(CentralParkLCPreview.Models.occupancyTimeline))), "")
现在我正在寻找我的价值观
12个月,14个月,16个月,18个月而不是TweleveMonths,十四个月,十六个月,十八个月
我怎么做到这一点?
public enum occupancyTimeline
{
    TwelveMonths=0,
    FourteenMonths=1,
    SixteenMonths=2,
    EighteenMonths=3
}
public string[] enumString = {
    "12 Months", "14 Months", "16 Months", "18 Months"};
string selectedEnum = enumString[(int)occupancyTimeLine.TwelveMonths];
或者
public enum occupancyTimeline
{
    TwelveMonths,
    FourteenMonths,
    SixteenMonths,
    EighteenMonths
}
public string[] enumString = {
    "12 Months", "14 Months", "16 Months", "18 Months"};
string selectedEnum = enumString[DropDownList.SelectedIndex];
| 归档时间: | 
 | 
| 查看次数: | 995 次 | 
| 最近记录: |