2 // XmlAttributeOverrides.cs:
5 // John Donagher (john@webmeta.com)
7 // (C) 2002 John Donagher
11 using System.Collections;
\r
13 namespace System.Xml.Serialization
\r
16 /// Summary description for XmlAttributeOverrides.
\r
18 public class XmlAttributeOverrides
\r
21 private Hashtable overrides;
\r
23 public XmlAttributeOverrides ()
\r
25 overrides = new Hashtable();
\r
28 public XmlAttributes this [Type type]
\r
30 get { return this [type, string.Empty]; }
\r
33 public XmlAttributes this [Type type, string member]
\r
37 return (XmlAttributes) overrides[GetKey(type,member)];
\r
41 public void Add (Type type, XmlAttributes attributes)
\r
43 Add(type, string.Empty, attributes);
\r
46 public void Add (Type type, string member, XmlAttributes attributes)
\r
48 if(overrides[GetKey(type, member)] != null)
\r
49 throw new Exception("The attributes for the given type and Member already exist in the collection");
\r
51 overrides.Add(GetKey(type,member), attributes);
\r
54 private TypeMember GetKey(Type type, string member)
\r
56 return new TypeMember(type, member);
\r
59 internal bool InternalEquals (XmlAttributeOverrides other)
\r
61 if (other == null) return false;
\r
62 if (overrides.Count != other.overrides.Count) return false;
\r
64 foreach (DictionaryEntry entry in overrides)
\r
66 XmlAttributes val = (XmlAttributes) other.overrides [entry.Key];
\r
67 if (val == null || !val.Equals ((XmlAttributes) entry.Value)) return false;
\r