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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlMembersMapping.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;
  20.     using System.Text;
  21.    
  22.     /// <include file='doc\XmlMembersMapping.uex' path='docs/doc[@for="XmlMembersMapping"]/*' />
  23.     ///<internalonly/>
  24.     /// <devdoc>
  25.     /// <para>[To be supplied.]</para>
  26.     /// </devdoc>
  27.     public class XmlMembersMapping : XmlMapping
  28.     {
  29.         XmlMemberMapping[] mappings;
  30.        
  31.         internal XmlMembersMapping(TypeScope scope, ElementAccessor accessor, XmlMappingAccess access) : base(scope, accessor, access)
  32.         {
  33.             MembersMapping mapping = (MembersMapping)accessor.Mapping;
  34.             StringBuilder key = new StringBuilder();
  35.             key.Append(":");
  36.             mappings = new XmlMemberMapping[mapping.Members.Length];
  37.             for (int i = 0; i < mappings.Length; i++) {
  38.                 if (mapping.Members[i].TypeDesc.Type != null) {
  39.                     key.Append(GenerateKey(mapping.Members[i].TypeDesc.Type, null, null));
  40.                     key.Append(":");
  41.                 }
  42.                 mappings[i] = new XmlMemberMapping(mapping.Members[i]);
  43.             }
  44.             SetKeyInternal(key.ToString());
  45.         }
  46.        
  47.         /// <include file='doc\XmlMembersMapping.uex' path='docs/doc[@for="XmlMembersMapping.TypeName"]/*' />
  48.         /// <devdoc>
  49.         /// <para>[To be supplied.]</para>
  50.         /// </devdoc>
  51.         public string TypeName {
  52.             get { return Accessor.Mapping.TypeName; }
  53.         }
  54.        
  55.         /// <include file='doc\XmlMembersMapping.uex' path='docs/doc[@for="XmlMembersMapping.TypeNamespace"]/*' />
  56.         /// <devdoc>
  57.         /// <para>[To be supplied.]</para>
  58.         /// </devdoc>
  59.         public string TypeNamespace {
  60.             get { return Accessor.Mapping.Namespace; }
  61.         }
  62.        
  63.         /// <include file='doc\XmlMembersMapping.uex' path='docs/doc[@for="XmlMembersMapping.this"]/*' />
  64.         /// <devdoc>
  65.         /// <para>[To be supplied.]</para>
  66.         /// </devdoc>
  67.         public XmlMemberMapping this[int index]
  68.         {
  69.             get { return mappings[index]; }
  70.         }
  71.        
  72.         /// <include file='doc\XmlMembersMapping.uex' path='docs/doc[@for="XmlMembersMapping.Count"]/*' />
  73.         /// <devdoc>
  74.         /// <para>[To be supplied.]</para>
  75.         /// </devdoc>
  76.         public int Count {
  77.             get { return mappings.Length; }
  78.         }
  79.     }
  80. }

Developer Fusion