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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlRootAttribute.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;
  19.     using System.Xml.Schema;
  20.    
  21.     /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute"]/*' />
  22.     /// <devdoc>
  23.     /// <para>[To be supplied.]</para>
  24.     /// </devdoc>
  25.     [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Struct)]
  26.     public class XmlRootAttribute : System.Attribute
  27.     {
  28.         string elementName;
  29.         string ns;
  30.         string dataType;
  31.         bool nullable = true;
  32.         bool nullableSpecified;
  33.        
  34.         /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.XmlRootAttribute"]/*' />
  35.         /// <devdoc>
  36.         /// <para>[To be supplied.]</para>
  37.         /// </devdoc>
  38.         public XmlRootAttribute()
  39.         {
  40.         }
  41.        
  42.         /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.XmlRootAttribute1"]/*' />
  43.         /// <devdoc>
  44.         /// <para>[To be supplied.]</para>
  45.         /// </devdoc>
  46.         public XmlRootAttribute(string elementName)
  47.         {
  48.             this.elementName = elementName;
  49.         }
  50.        
  51.         /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.ElementName"]/*' />
  52.         /// <devdoc>
  53.         /// <para>[To be supplied.]</para>
  54.         /// </devdoc>
  55.         public string ElementName {
  56.             get { return elementName == null ? string.Empty : elementName; }
  57.             set { elementName = value; }
  58.         }
  59.        
  60.         /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.Namespace"]/*' />
  61.         /// <devdoc>
  62.         /// <para>[To be supplied.]</para>
  63.         /// </devdoc>
  64.         public string Namespace {
  65.             get { return ns; }
  66.             set { ns = value; }
  67.         }
  68.        
  69.         /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.DataType"]/*' />
  70.         /// <devdoc>
  71.         /// <para>[To be supplied.]</para>
  72.         /// </devdoc>
  73.         public string DataType {
  74.             get { return dataType == null ? string.Empty : dataType; }
  75.             set { dataType = value; }
  76.         }
  77.        
  78.         /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.IsNullable"]/*' />
  79.         /// <devdoc>
  80.         /// <para>[To be supplied.]</para>
  81.         /// </devdoc>
  82.         public bool IsNullable {
  83.             get { return nullable; }
  84.             set {
  85.                 nullable = value;
  86.                 nullableSpecified = true;
  87.             }
  88.         }
  89.        
  90.         internal bool IsNullableSpecified {
  91.             get { return nullableSpecified; }
  92.         }
  93.        
  94.         internal string Key {
  95.             get { return (ns == null ? String.Empty : ns) + ":" + ElementName + ":" + nullable.ToString(); }
  96.         }
  97.     }
  98. }

Developer Fusion