XmlRootAttribute.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlRootAttribute.cs" company="Microsoft">
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. // </copyright>
  5. // <owner current="true" primary="true">Microsoft</owner>
  6. //------------------------------------------------------------------------------
  7. namespace System.Xml.Serialization {
  8. using System;
  9. using System.Xml.Schema;
  10. /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute"]/*' />
  11. /// <devdoc>
  12. /// <para>[To be supplied.]</para>
  13. /// </devdoc>
  14. [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Struct)]
  15. public class XmlRootAttribute : System.Attribute {
  16. string elementName;
  17. string ns;
  18. string dataType;
  19. bool nullable = true;
  20. bool nullableSpecified;
  21. /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.XmlRootAttribute"]/*' />
  22. /// <devdoc>
  23. /// <para>[To be supplied.]</para>
  24. /// </devdoc>
  25. public XmlRootAttribute() {
  26. }
  27. /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.XmlRootAttribute1"]/*' />
  28. /// <devdoc>
  29. /// <para>[To be supplied.]</para>
  30. /// </devdoc>
  31. public XmlRootAttribute(string elementName) {
  32. this.elementName = elementName;
  33. }
  34. /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.ElementName"]/*' />
  35. /// <devdoc>
  36. /// <para>[To be supplied.]</para>
  37. /// </devdoc>
  38. public string ElementName {
  39. get { return elementName == null ? string.Empty : elementName; }
  40. set { elementName = value; }
  41. }
  42. /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.Namespace"]/*' />
  43. /// <devdoc>
  44. /// <para>[To be supplied.]</para>
  45. /// </devdoc>
  46. public string Namespace {
  47. get { return ns; }
  48. set { ns = value; }
  49. }
  50. /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.DataType"]/*' />
  51. /// <devdoc>
  52. /// <para>[To be supplied.]</para>
  53. /// </devdoc>
  54. public string DataType {
  55. get { return dataType == null ? string.Empty : dataType; }
  56. set { dataType = value; }
  57. }
  58. /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.IsNullable"]/*' />
  59. /// <devdoc>
  60. /// <para>[To be supplied.]</para>
  61. /// </devdoc>
  62. public bool IsNullable {
  63. get { return nullable; }
  64. set {
  65. nullable = value;
  66. nullableSpecified = true;
  67. }
  68. }
  69. internal bool IsNullableSpecified {
  70. get { return nullableSpecified; }
  71. }
  72. internal string Key {
  73. get { return (ns == null ? String.Empty : ns) + ":" + ElementName + ":" + nullable.ToString(); }
  74. }
  75. }
  76. }