DataContractAttribute.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.Runtime.Serialization
  5. {
  6. [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, Inherited = false, AllowMultiple = false)]
  7. public sealed class DataContractAttribute : Attribute
  8. {
  9. string name;
  10. string ns;
  11. bool isNameSetExplicitly;
  12. bool isNamespaceSetExplicitly;
  13. bool isReference;
  14. bool isReferenceSetExplicitly;
  15. public DataContractAttribute()
  16. {
  17. }
  18. public bool IsReference
  19. {
  20. get { return isReference; }
  21. set
  22. {
  23. isReference = value;
  24. isReferenceSetExplicitly = true;
  25. }
  26. }
  27. public bool IsReferenceSetExplicitly
  28. {
  29. get { return isReferenceSetExplicitly; }
  30. }
  31. public string Namespace
  32. {
  33. get { return ns; }
  34. set
  35. {
  36. ns = value;
  37. isNamespaceSetExplicitly = true;
  38. }
  39. }
  40. public bool IsNamespaceSetExplicitly
  41. {
  42. get { return isNamespaceSetExplicitly; }
  43. }
  44. public string Name
  45. {
  46. get { return name; }
  47. set
  48. {
  49. name = value;
  50. isNameSetExplicitly = true;
  51. }
  52. }
  53. public bool IsNameSetExplicitly
  54. {
  55. get { return isNameSetExplicitly; }
  56. }
  57. }
  58. }