Candor.Configuration.Provider.ProviderHelperExtensions.GetStringValue C# (CSharp) 메소드

GetStringValue() 공개 정적인 메소드

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.
리턴 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;
        }