CollectionDataContractAttribute.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.Runtime.Serialization
  5. {
  6. [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
  7. public sealed class CollectionDataContractAttribute : Attribute
  8. {
  9. string name;
  10. string ns;
  11. string itemName;
  12. string keyName;
  13. string valueName;
  14. bool isReference;
  15. bool isNameSetExplicitly;
  16. bool isNamespaceSetExplicitly;
  17. bool isReferenceSetExplicitly;
  18. bool isItemNameSetExplicitly;
  19. bool isKeyNameSetExplicitly;
  20. bool isValueNameSetExplicitly;
  21. public CollectionDataContractAttribute()
  22. {
  23. }
  24. public string Namespace
  25. {
  26. get { return ns; }
  27. set
  28. {
  29. ns = value;
  30. isNamespaceSetExplicitly = true;
  31. }
  32. }
  33. public bool IsNamespaceSetExplicitly
  34. {
  35. get { return isNamespaceSetExplicitly; }
  36. }
  37. public string Name
  38. {
  39. get { return name; }
  40. set
  41. {
  42. name = value;
  43. isNameSetExplicitly = true;
  44. }
  45. }
  46. public bool IsNameSetExplicitly
  47. {
  48. get { return isNameSetExplicitly; }
  49. }
  50. public string ItemName
  51. {
  52. get { return itemName; }
  53. set
  54. {
  55. itemName = value;
  56. isItemNameSetExplicitly = true;
  57. }
  58. }
  59. public bool IsItemNameSetExplicitly
  60. {
  61. get { return isItemNameSetExplicitly; }
  62. }
  63. public string KeyName
  64. {
  65. get { return keyName; }
  66. set
  67. {
  68. keyName = value;
  69. isKeyNameSetExplicitly = true;
  70. }
  71. }
  72. public bool IsReference
  73. {
  74. get { return isReference; }
  75. set
  76. {
  77. isReference = value;
  78. isReferenceSetExplicitly = true;
  79. }
  80. }
  81. public bool IsReferenceSetExplicitly
  82. {
  83. get { return isReferenceSetExplicitly; }
  84. }
  85. public bool IsKeyNameSetExplicitly
  86. {
  87. get { return isKeyNameSetExplicitly; }
  88. }
  89. public string ValueName
  90. {
  91. get { return valueName; }
  92. set
  93. {
  94. valueName = value;
  95. isValueNameSetExplicitly = true;
  96. }
  97. }
  98. public bool IsValueNameSetExplicitly
  99. {
  100. get { return isValueNameSetExplicitly; }
  101. }
  102. }
  103. }