XmlArrayItemAttribute.cs 2.0 KB

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