예제 #1
0
 /// <summary>
 /// 根据关键字获取key对应的配置项
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public KeyValueItem this[string key]
 {
     get
     {
         var pair = this.KeyValueItems.Where(pre => pre.Key.Equals(key, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
         if (pair != null)
             return pair;
         if (!string.IsNullOrEmpty(Utility.Config.ConfigHelper.GetAppSettingOrDefault(key)))
         {
             pair = new KeyValueItem() { Key = key, Value = Utility.Config.ConfigHelper.GetAppSettingOrDefault(key) };
             KeyValueItems.Add(pair);
         }
         return pair;
     }
 }
예제 #2
0
 /// <summary>
 /// 根据关键字获取key对应的配置项
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public KeyValueItem this[string key]
 {
     get
     {
         var pair = this.KeyValueItems.Where(pre => pre.Key.Equals(key, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
         if (pair != null)
         {
             return(pair);
         }
         if (!string.IsNullOrEmpty(Utility.Config.ConfigHelper.GetAppSettingOrDefault(key)))
         {
             pair = new KeyValueItem()
             {
                 Key = key, Value = Utility.Config.ConfigHelper.GetAppSettingOrDefault(key)
             };
             KeyValueItems.Add(pair);
         }
         return(pair);
     }
 }