T
Toska
Hi,
Wonder how I can convert a string value to enum value.
Code
-------------------
<appSettings>
<add key="BaseType" value="Sand" />
</appSettings>
-------------------
Code
-------------------
enum BaseType : int
{
Sand,
Water,
Earth
}
public static BaseType GetBaseType()
{
object dbtype = HttpContext.Current.Cache["basetype"];
if(dbtype == null)
{
BaseType idbtype = (BaseType)ConfigurationSettings.AppSettings["BaseType"];
HttpContext.Current.Cache["basetype"] = idbtype;
return idbtype;
}
return (BaseType)dbtype;
}
Wonder how I can convert a string value to enum value.
Code
-------------------
<appSettings>
<add key="BaseType" value="Sand" />
</appSettings>
-------------------
Code
-------------------
enum BaseType : int
{
Sand,
Water,
Earth
}
public static BaseType GetBaseType()
{
object dbtype = HttpContext.Current.Cache["basetype"];
if(dbtype == null)
{
BaseType idbtype = (BaseType)ConfigurationSettings.AppSettings["BaseType"];
HttpContext.Current.Cache["basetype"] = idbtype;
return idbtype;
}
return (BaseType)dbtype;
}