The Labs \ Source Viewer \ SSCLI \ System.Xml.Serialization \ SoapAttributeOverrides

  1. //------------------------------------------------------------------------------
  2. // <copyright file="SoapAttributeOverrides.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. // <owner current="true" primary="true">ElenaK</owner>
  15. //------------------------------------------------------------------------------
  16. namespace System.Xml.Serialization
  17. {
  18.     using System.Reflection;
  19.     using System.Collections;
  20.     using System.IO;
  21.     using System.Xml.Schema;
  22.     using System;
  23.     using System.ComponentModel;
  24.    
  25.     /// <include file='doc\SoapAttributeOverrides.uex' path='docs/doc[@for="SoapAttributeOverrides"]/*' />
  26.     /// <devdoc>
  27.     /// <para>[To be supplied.]</para>
  28.     /// </devdoc>
  29.     public class SoapAttributeOverrides
  30.     {
  31.         Hashtable types = new Hashtable();
  32.        
  33.         /// <include file='doc\SoapAttributeOverrides.uex' path='docs/doc[@for="SoapAttributeOverrides.Add"]/*' />
  34.         /// <devdoc>
  35.         /// <para>[To be supplied.]</para>
  36.         /// </devdoc>
  37.         public void Add(Type type, SoapAttributes attributes)
  38.         {
  39.             Add(type, string.Empty, attributes);
  40.         }
  41.        
  42.         /// <include file='doc\SoapAttributeOverrides.uex' path='docs/doc[@for="SoapAttributeOverrides.Add1"]/*' />
  43.         /// <devdoc>
  44.         /// <para>[To be supplied.]</para>
  45.         /// </devdoc>
  46.         public void Add(Type type, string member, SoapAttributes attributes)
  47.         {
  48.             Hashtable members = (Hashtable)types[type];
  49.             if (members == null) {
  50.                 members = new Hashtable();
  51.                 types.Add(type, members);
  52.             }
  53.             else if (members[member] != null) {
  54.                 throw new InvalidOperationException(Res.GetString(Res.XmlMultipleAttributeOverrides, type.FullName, member));
  55.             }
  56.             members.Add(member, attributes);
  57.         }
  58.        
  59.         /// <include file='doc\SoapAttributeOverrides.uex' path='docs/doc[@for="SoapAttributeOverrides.this"]/*' />
  60.         /// <devdoc>
  61.         /// <para>[To be supplied.]</para>
  62.         /// </devdoc>
  63.         public SoapAttributes this[Type type]
  64.         {
  65.             get { return this[type, string.Empty]; }
  66.         }
  67.        
  68.         /// <include file='doc\SoapAttributeOverrides.uex' path='docs/doc[@for="SoapAttributeOverrides.this1"]/*' />
  69.         /// <devdoc>
  70.         /// <para>[To be supplied.]</para>
  71.         /// </devdoc>
  72.         public SoapAttributes this[Type type, string member]
  73.         {
  74.             get {
  75.                 Hashtable members = (Hashtable)types[type];
  76.                 if (members == null)
  77.                     return null;
  78.                 return (SoapAttributes)members[member];
  79.             }
  80.         }
  81.     }
  82. }

Developer Fusion