C #: Как убедиться, что переменная настроек существует, прежде чем пытаться использовать ее из другой сборки?

У меня есть следующее:

using CommonSettings = MyProject.Commons.Settings;

public class Foo
{
    public static void DoSomething(string str)
    {
        //How do I make sure that the setting exists first?
        object setting = CommonSettings.Default[str];

        DoSomethingElse(setting);
    }
}
12
задан michael 10 January 2011 в 14:27
поделиться