SenparcWeixinSettingItemCollection.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*----------------------------------------------------------------
  2. Copyright (C) 2019 Senparc
  3. 文件名:SenparcWeixinSettingItemCollection.cs
  4. 文件功能描述:SenparcWeixinSettingItem 集合
  5. 创建标识:Senparc - 20180707
  6. 修改标识:Senparc - 20150303
  7. 修改描述:整理接口
  8. ----------------------------------------------------------------*/
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. namespace Senparc.Weixin.Entities
  15. {
  16. /// <summary>
  17. /// SenparcWeixinSettingItem 集合
  18. /// </summary>
  19. public class SenparcWeixinSettingItemCollection : Dictionary<string, SenparcWeixinSettingItem>
  20. {
  21. public SenparcWeixinSettingItemCollection() : base(StringComparer.OrdinalIgnoreCase)
  22. {
  23. }
  24. /// <summary>
  25. /// 设置或获取 SenparcWeixinSettingItem,key 不存在时会自动创建对象,因此不需要判断 key 是否存在
  26. /// </summary>
  27. /// <param name="key">SenparcWeixinSettingItem 标识</param>
  28. /// <returns></returns>
  29. new public SenparcWeixinSettingItem this[string key]
  30. {
  31. get
  32. {
  33. if (!base.ContainsKey(key))
  34. {
  35. base[key] = new SenparcWeixinSettingItem();
  36. }
  37. return base[key];
  38. }
  39. set
  40. {
  41. base[key] = value;
  42. base[key].ItemKey = key;//设置标识
  43. }
  44. }
  45. }
  46. }