Hi,
In the Settings tab in Visual Studio, I can see Name, Type, Scope, Value table. Define settings is intuitive if the data type is already within the Type drop-down list i.e. integer, string, long etc.
But I can't find enum anywhere.
How do I save enum settings then?
For now, I have the following which clutter my code too much.
public enum Action
{
LOCK = 9,
FORCED_LOGOFF = 12,
SHUTDOWN = 14,
REBOOT,
LOGOFF = FORCED_LOGOFF
};
and I define Action as int in the setting. Then I have to do,
switch (Properties.Settings.Default.Action)
{
case 9: SetAction(Action.LOCK); break;
case 12: SetAction(Action.FORCED_LOGOFF); break;
case 14: SetAction(Action.SHUTDOWN); break;
case 15: SetAction(Action.REBOOT); break;
default: SetAction(Action.LOCK); break;
}
Would be nice if I could simply do something like
SetAction(Properties.Settings.Default.Action);
to replace all above but I dont know how to save enum in setting. Hope my question is clear.
Thanks.