XmlRootAttribute.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // XmlRootAttribute.cs:
  3. //
  4. // Author:
  5. // John Donagher ([email protected])
  6. //
  7. // (C) 2002 John Donagher
  8. //
  9. using System;
  10. namespace System.Xml.Serialization
  11. {
  12. /// <summary>
  13. /// Summary description for XmlRootAttribute.
  14. /// </summary>
  15. [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
  16. AttributeTargets.Enum | AttributeTargets.Interface |
  17. AttributeTargets.ReturnValue)]
  18. public class XmlRootAttribute : Attribute
  19. {
  20. private string dataType;
  21. private string elementName;
  22. private bool isNullable = true;
  23. private string ns;
  24. public XmlRootAttribute ()
  25. {
  26. }
  27. public XmlRootAttribute (string elementName)
  28. {
  29. ElementName = elementName;
  30. }
  31. public string DataType
  32. {
  33. get {
  34. return dataType;
  35. }
  36. set {
  37. dataType = value;
  38. }
  39. }
  40. public string ElementName
  41. {
  42. get {
  43. return elementName;
  44. }
  45. set {
  46. elementName = value;
  47. }
  48. }
  49. public bool IsNullable
  50. {
  51. get {
  52. return isNullable;
  53. }
  54. set {
  55. isNullable = value;
  56. }
  57. }
  58. public string Namespace
  59. {
  60. get {
  61. return ns;
  62. }
  63. set {
  64. ns = value;
  65. }
  66. }
  67. internal void AddKeyHash (System.Text.StringBuilder sb)
  68. {
  69. sb.Append ("XRA ");
  70. KeyHelper.AddField (sb, 1, ns);
  71. KeyHelper.AddField (sb, 2, elementName);
  72. KeyHelper.AddField (sb, 3, dataType);
  73. KeyHelper.AddField (sb, 4, isNullable);
  74. sb.Append ('|');
  75. }
  76. }
  77. }