Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Xml / System / Xml / Serialization / XmlAttributeOverrides.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="XmlAttributeOverrides.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 // <owner current="true" primary="true">Microsoft</owner>                                                                
6 //------------------------------------------------------------------------------
7
8 namespace System.Xml.Serialization {
9     using System.Reflection;
10     using System.Collections;
11     using System.IO;
12     using System.Xml.Schema;
13     using System;
14     using System.ComponentModel;
15
16     /// <include file='doc\XmlAttributeOverrides.uex' path='docs/doc[@for="XmlAttributeOverrides"]/*' />
17     /// <devdoc>
18     ///    <para>[To be supplied.]</para>
19     /// </devdoc>
20     public class XmlAttributeOverrides {
21         Hashtable types = new Hashtable();
22
23         /// <include file='doc\XmlAttributeOverrides.uex' path='docs/doc[@for="XmlAttributeOverrides.Add"]/*' />
24         /// <devdoc>
25         ///    <para>[To be supplied.]</para>
26         /// </devdoc>
27         public void Add(Type type, XmlAttributes attributes) {
28             Add(type, string.Empty, attributes);
29         }
30
31         /// <include file='doc\XmlAttributeOverrides.uex' path='docs/doc[@for="XmlAttributeOverrides.Add1"]/*' />
32         /// <devdoc>
33         ///    <para>[To be supplied.]</para>
34         /// </devdoc>
35         public void Add(Type type, string member, XmlAttributes attributes) {
36             Hashtable members = (Hashtable)types[type];
37             if (members == null) {
38                 members = new Hashtable();
39                 types.Add(type, members);
40             }
41             else if (members[member] != null) {
42                 throw new InvalidOperationException(Res.GetString(Res.XmlAttributeSetAgain, type.FullName, member));
43             }
44             members.Add(member, attributes);
45         }
46
47         /// <include file='doc\XmlAttributeOverrides.uex' path='docs/doc[@for="XmlAttributeOverrides.this"]/*' />
48         /// <devdoc>
49         ///    <para>[To be supplied.]</para>
50         /// </devdoc>
51         public XmlAttributes this[Type type] {
52             get {
53                 return this[type, string.Empty];
54             }
55         }
56
57         /// <include file='doc\XmlAttributeOverrides.uex' path='docs/doc[@for="XmlAttributeOverrides.this1"]/*' />
58         /// <devdoc>
59         ///    <para>[To be supplied.]</para>
60         /// </devdoc>
61         public XmlAttributes this[Type type, string member] {
62             get {
63                 Hashtable members = (Hashtable)types[type];
64                 if (members == null) return null;
65                 return (XmlAttributes)members[member];
66             }
67         }
68     }
69 }
70