Azavea.Open.Common.Config.GetConfig C# (CSharp) Method

GetConfig() public static method

This allows you to avoid reading the same config file over and over again. Since Config objects are read-only, we can read the file once and hand the same object out over and over without worrying about threading issues.
public static GetConfig ( string appName ) : Config
appName string Identifies which config file we want.
return Config
        public static Config GetConfig(string appName)
        {
            if (!StringHelper.IsNonBlank(appName))
            {
                throw new ArgumentNullException("appName", "Cannot construct a config with a blank/null app name.");
            }
            Config retVal = null;
            lock (_configCache)
            {
                if (_configCache.ContainsKey(appName))
                {
                    retVal = _configCache[appName];
                }
            }
            if (retVal == null)
            {
                retVal = new Config(appName);
                lock (_configCache)
                {
                    _configCache[appName] = retVal;
                }
            }
            return retVal;
        }