Elmah.ErrorTweetModule.GetSetting C# (CSharp) Méthode

GetSetting() private static méthode

private static GetSetting ( System.Collections.IDictionary config, string name, string defaultValue ) : string
config System.Collections.IDictionary
name string
defaultValue string
Résultat string
        private static string GetSetting(IDictionary config, string name, string defaultValue)
        {
            Debug.Assert(config != null);
            Debug.AssertStringNotEmpty(name);

            var value = ((string)config[name]) ?? string.Empty;

            if (value.Length == 0)
            {
                if (defaultValue == null)
                {
                    throw new ApplicationException(string.Format(
                        "The required configuration setting '{0}' is missing for the error tweeting module.", name));
                }

                value = defaultValue;
            }

            return value;
        }
    }