This project has moved and is read-only. For the latest updates, please go here.
1

Closed

Default Value

description

Provide a way to have a default value, instead of testing if the value actually exist and if true, get the value, else use a default value like this:
 
ConfigFile config = new ConfigFile("Config.ini");
 
if (config.SettingGroups["Default"].Settings.ContainsKey("Param1"))
myParam = config.SettingGroups["Default"].Settings["Param1"].GetValueAsInt())
else
myParam = 0;
Closed Jan 9, 2011 at 6:44 PM by SimReality
There's no real clean way of doing this. I think that checking against the dictionary with either the TryGetValue or ContainsKey methods is the best way to go.

comments