Example #1
0
        /// <summary>
        /// 判断key是否在配置里
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        internal static bool ContainsKey(string key)
        {
            if (map == null)
            {
                map = DynamicConfigFileManager.GetConfigData <GlobalData>("GlobalData").ToMap(o => o.Key);
            }

            return(map.ContainsKey(key));
        }
Example #2
0
        /// <summary>
        ///     根据Key 获得字符串
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string GetValue(string key)
        {
            if (map == null)
            {
                map = DynamicConfigFileManager.GetConfigData <GlobalData>("GlobalData").ToMap(o => o.Key);
            }

            GlobalData item;

            if (map.TryGetValue(key, out item))
            {
                return(item.Value);
            }

            return(string.Empty);
        }