I have the following code:
public string GetSetting(string setting)
{
return db2.ExecuteScalar<string>("SELECT VALUE FROM Setting WHERE SettingType = ?", setting);
}
public enum NOA
{
All = 0,
Five = 5,
Seven = 7,
Nine = 9,
Ten = 10
}
public static partial class Extensions
{
public static string Text(this NOA noa)
{
switch (noa)
{
case NOA.Ten: return "10";
case NOA.Five: return "5";
case NOA.Seven: return "7";
case NOA.Nine: return "9";
}
return "";
}
}
What I would like to do is to get the value of noa and cast it to a NOA.
Here's what I have tried. But I get an error saying "String does not contain a definition for Value":
NOA noa = (NOA)App.DB.GetSetting("NumberOfAnswers").Value;
When I try this. I get an error saying "Cannot convert type string to Japanese.NOA:
NOA noa = (NOA)App.DB.GetSetting("NumberOfAnswers");
Can someone tell me how I can get the value and put it into noa?