我想将字符串转换为枚举。我的代码就像这个
var categoryEnum = (SiteCategory) Enum.Parse(typeof (SiteCategory), UIController.QueryStringParamInitialValue, true);
和 queryStringParaminitialValue ((就像
public static string QueryStringParamInitialValue
{
get
{
string str = string.Empty;
if (HttpContext.Current != null && HttpContext.Current.Session != null && HttpContext.Current.Session["UIController_QueryStringParamInitialValue"] != null)
str = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Session["UIController_QueryStringParamInitialValue"] as string);
return str;
}
set
{
HttpContext.Current.Session["UIController_QueryStringParamInitialValue"] = (object)HttpContext.Current.Server.UrlEncode(value);
}
}
我在 var categoryEnum =(siteCategory(中面临错误 有关此信息的任何信息都会有所帮助。 如果将此错误视为Xamarin项目的一部分: 如下所述,我必须至少在更新后一次启动xcode。" 才能消失。XCode更新并启动后,我还必须重新启动Visual Studio。