2 // System.Collections.Specialized.StringDictionary.cs
\r
5 // Andreas Nahr (ClassDevelopment@A-SoftTech.com)
\r
7 // (C) Ximian, Inc. http://www.ximian.com
\r
8 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
\r
10 // Permission is hereby granted, free of charge, to any person obtaining
\r
11 // a copy of this software and associated documentation files (the
\r
12 // "Software"), to deal in the Software without restriction, including
\r
13 // without limitation the rights to use, copy, modify, merge, publish,
\r
14 // distribute, sublicense, and/or sell copies of the Software, and to
\r
15 // permit persons to whom the Software is furnished to do so, subject to
\r
16 // the following conditions:
\r
18 // The above copyright notice and this permission notice shall be
\r
19 // included in all copies or substantial portions of the Software.
\r
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\r
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
\r
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
\r
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
\r
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
31 using System.ComponentModel.Design.Serialization;
\r
33 using System.Globalization;
\r
35 namespace System.Collections.Specialized {
\r
41 [DesignerSerializer ("System.Diagnostics.Design.StringDictionaryCodeDomSerializer, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
\r
43 public class StringDictionary : IEnumerable
\r
45 private Hashtable contents;
\r
47 public StringDictionary()
\r
49 contents = new Hashtable();
\r
52 // Public Instance Properties
\r
54 public virtual int Count
\r
57 return contents.Count;
\r
61 public virtual bool IsSynchronized
\r
68 public virtual string this[string key]
\r
73 throw new ArgumentNullException ("key");
\r
75 return (string) contents [key.ToLower (CultureInfo.InvariantCulture)];
\r
81 throw new ArgumentNullException ("key");
\r
83 contents[key.ToLower(CultureInfo.InvariantCulture)] = value;
\r
87 public virtual ICollection Keys
\r
90 return contents.Keys;
\r
94 public virtual ICollection Values
\r
97 return contents.Values;
\r
101 public virtual object SyncRoot
\r
104 return contents.SyncRoot;
\r
108 // Public Instance Methods
\r
110 public virtual void Add(string key, string value)
\r
114 throw new ArgumentNullException ("key");
\r
116 contents.Add (key.ToLower (CultureInfo.InvariantCulture), value);
\r
119 public virtual void Clear()
\r
124 public virtual bool ContainsKey(string key)
\r
128 throw new ArgumentNullException ("key");
\r
130 return contents.ContainsKey (key.ToLower (CultureInfo.InvariantCulture));
\r
133 public virtual bool ContainsValue(string value)
\r
135 return contents.ContainsValue(value);
\r
138 public virtual void CopyTo(Array array, int index)
\r
140 contents.CopyTo(array, index);
\r
143 public virtual IEnumerator GetEnumerator()
\r
145 return contents.GetEnumerator();
\r
148 public virtual void Remove(string key)
\r
152 throw new ArgumentNullException ("key");
\r
154 contents.Remove (key.ToLower (CultureInfo.InvariantCulture));
\r