StringDictionary.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // System.Collections.Specialized.StringDictionary.cs
  3. //
  4. // Author:
  5. // Andreas Nahr ([email protected])
  6. //
  7. // (C) Ximian, Inc. http://www.ximian.com
  8. //
  9. using System.ComponentModel.Design.Serialization;
  10. namespace System.Collections.Specialized
  11. {
  12. [DesignerSerializer ("System.Diagnostics.Design.StringDictionaryCodeDomSerializer, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
  13. public class StringDictionary : IEnumerable
  14. {
  15. private Hashtable table;
  16. public StringDictionary()
  17. {
  18. table = new Hashtable();
  19. }
  20. // Public Instance Properties
  21. public virtual int Count
  22. {
  23. get {
  24. return table.Count;
  25. }
  26. }
  27. public virtual bool IsSynchronized
  28. {
  29. get {
  30. return false;
  31. }
  32. }
  33. public virtual string this[string key]
  34. {
  35. get {
  36. return (string) table[key.ToLower()];
  37. }
  38. set {
  39. table[key.ToLower()] = value;
  40. }
  41. }
  42. public virtual ICollection Keys
  43. {
  44. get {
  45. return table.Keys;
  46. }
  47. }
  48. public virtual ICollection Values
  49. {
  50. get {
  51. return table.Values;
  52. }
  53. }
  54. public virtual object SyncRoot
  55. {
  56. get {
  57. return table.SyncRoot;
  58. }
  59. }
  60. // Public Instance Methods
  61. public virtual void Add(string key, string value)
  62. {
  63. table.Add(key.ToLower(), value);
  64. }
  65. public virtual void Clear()
  66. {
  67. table.Clear();
  68. }
  69. public virtual bool ContainsKey(string key)
  70. {
  71. return table.ContainsKey(key.ToLower());
  72. }
  73. public virtual bool ContainsValue(string value)
  74. {
  75. return table.ContainsValue(value);
  76. }
  77. public virtual void CopyTo(Array array, int index)
  78. {
  79. table.CopyTo(array, index);
  80. }
  81. public virtual IEnumerator GetEnumerator()
  82. {
  83. return table.GetEnumerator();
  84. }
  85. public virtual void Remove(string key)
  86. {
  87. table.Remove(key.ToLower());
  88. }
  89. }
  90. }