You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.4 KiB

  1. using System;
  2. namespace Newtonsoft.Json
  3. {
  4. /// <summary>
  5. /// Instructs the <see cref="JsonSerializer"/> to deserialize properties with no matching class member into the specified collection
  6. /// and write values during serialization.
  7. /// </summary>
  8. [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
  9. internal class JsonExtensionDataAttribute : Attribute
  10. {
  11. /// <summary>
  12. /// Gets or sets a value that indicates whether to write extension data when serializing the object.
  13. /// </summary>
  14. /// <value>
  15. /// <c>true</c> to write extension data when serializing the object; otherwise, <c>false</c>. The default is <c>true</c>.
  16. /// </value>
  17. public bool WriteData { get; set; }
  18. /// <summary>
  19. /// Gets or sets a value that indicates whether to read extension data when deserializing the object.
  20. /// </summary>
  21. /// <value>
  22. /// <c>true</c> to read extension data when deserializing the object; otherwise, <c>false</c>. The default is <c>true</c>.
  23. /// </value>
  24. public bool ReadData { get; set; }
  25. /// <summary>
  26. /// Initializes a new instance of the <see cref="JsonExtensionDataAttribute"/> class.
  27. /// </summary>
  28. public JsonExtensionDataAttribute()
  29. {
  30. WriteData = true;
  31. ReadData = true;
  32. }
  33. }
  34. }