Candor.Configuration.Provider.ProviderHelperExtensions.GetStringValue C# (CSharp) Method

GetStringValue() public static method

A helper method to get a string value from a configuration setting value.
public static GetStringValue ( this config, string name, String defaultValue ) : string
config this The available configuation values.
name string The name of the setting to retrieve.
defaultValue String The default in case the named /// value does not exist.
return string
        public static string GetStringValue( this NameValueCollection config,
			string name, String defaultValue )
        {
            if (config == null)
                return defaultValue;
            string val = config[name];
            if (val == null)
                return defaultValue;
            val = val.Trim();
            if (val.Length == 0)
                return defaultValue;
            return val;
        }