【发布时间】:2013-04-17 11:45:28
【问题描述】:
我有 ASP.NET 应用程序,想在 if 语句中使用枚举。
我以这种方式获得变量:
string choice = (string)Session["export_choice"];
if(choice == <here goes enum>)
{
}
else
{
}
枚举只能有 2 个字符串值。
【问题讨论】:
-
将
choice设为枚举类型;请参阅 Enum.TryParse msdn.microsoft.com/en-GB/library/dd991317.aspx
标签: asp.net if-statement enums