I'm trying to load some AppSettings into an object. The settings look like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Logging_default_path" value="C:\Temp" />
<add key="Logging_max_file_size" value="10485760" />
<add key="Logging_levels" value="Error,Warning,Info"/>
<add key="Logging_filename" value="RobinsonLog" />
</appSettings>
</configuration>
The Logging_levels represents several enum values that are allowed by the settings. I'm trying to load these into my object by using the following code:
Level = (LogLevel)Enum.Parse(typeof(LogLevel), settings["Logging_levels"]);
But this is not working and I'm only getting LogLevel.Info returned, not the value of Loglevel.Error | LogLevel.Warning | LogLevel.Info. The enum is defined as followed:
[Flags]
public enum LogLevel
{
Error = 0x0,
Warning = 0x1,
Info = 0x2,
Debug = 0x3,
Performance = 0x4
}
Am I wrong by defining the values in hex? or did I miss something else?