C# MVC-从枚举中排除

C# MVC-从枚举中排除,c#,asp.net-mvc,razor,enums,C#,Asp.net Mvc,Razor,Enums,我有一个enum,在下拉列表中用于选择。我不想在我的下拉列表中显示1st enum,它是NA 如何从enum中排除1个元素 public enum EmployeeStatus { NA = 1, Active = 2, InActive = 3, Other = 5 } @Html.DropDownListFor(model => model.EmployeeStatus, Enum.GetNames(ty

我有一个
enum
,在
下拉列表中用于选择。我不想在我的
下拉列表中显示
1st enum
,它是
NA

如何从
enum
中排除
1个元素

public enum EmployeeStatus
    {
        NA = 1,
        Active = 2,
        InActive = 3,
        Other = 5
    }

@Html.DropDownListFor(model => model.EmployeeStatus, Enum.GetNames(typeof(Models.EmployeeStatus)).Select(e => new SelectListItem { Text = e }), "--Select Type--", new { @class = "form-control" })

您可以使用
Where

Enum.GetNames(typeof(Models.EmployeeStatus)).Where(x => x != "NA")

您可以使用
Where

Enum.GetNames(typeof(Models.EmployeeStatus)).Where(x => x != "NA")