diff --git a/Doc/SerializationAttributes.aml b/Doc/SerializationAttributes.aml index 8b313f91..b05adc0b 100644 --- a/Doc/SerializationAttributes.aml +++ b/Doc/SerializationAttributes.aml @@ -124,6 +124,10 @@ The T:Newtonsoft.Json.JsonExtensionDataAttribute instructs the T:Newtonsoft.Json.JsonSerializer to deserialize properties with no matching field or property on the type into the specified collection. During serialization the values in this collection are written back to the instance's JSON object. + + + All extension data values will be written during serialization, even if a property the same name has already been written. + This example shows the JsonExtensionDataAttribute being applied to a field, unmatched JSON properties being added to the field's collection during deserialization. diff --git a/Src/Newtonsoft.Json/Linq/JObject.cs b/Src/Newtonsoft.Json/Linq/JObject.cs index 25e71fad..55e13d75 100644 --- a/Src/Newtonsoft.Json/Linq/JObject.cs +++ b/Src/Newtonsoft.Json/Linq/JObject.cs @@ -706,10 +706,7 @@ namespace Newtonsoft.Json.Linq /// Name of the property. protected virtual void OnPropertyChanged(string propertyName) { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); - } + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } #if !(PORTABLE40 || PORTABLE || NET20) @@ -719,10 +716,7 @@ namespace Newtonsoft.Json.Linq /// Name of the property. protected virtual void OnPropertyChanging(string propertyName) { - if (PropertyChanging != null) - { - PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); - } + PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName)); } #endif