I have the following:
using CommonSettings = MyProject.Commons.Settings;
public class Foo
{
public static void DoSomething(string str)
{
//How d
You could do the following:
public static void DoSomething(string str)
{
object setting = null;
Try
{
setting = CommonSettings.Default[str];
}
catch(Exception ex)
{
Console.out.write(ex.Message);
}
if(setting != null)
{
DoSomethingElse(setting);
}
}
This would ensure the setting exists - you could go a bit further and try and catch the exact excetion - e.g catch(IndexOutOfBoundsException ex)