Missing example or documentation on the meaning of parameters of JsonPropertyInfo.Set delegate
Type of issue
Missing information
Description
I do not find the value corresponding to the two parameters of JsonPropertyInfo.Set delegate.
I finally found that:
- The first one is the instance being deserialized
- The second one is the value of the
JsonPropertyInfoproperty that will be set.
I think that an explanation could be useful. As an example, we could use:
jsonPropertyInfo.Set = (instance, propertyValue) =>
{
instance.GetType().GetProperty(jsonPropertyInfo.Name)!.DeclaringType!.GetProperty(jsonPropertyInfo.Name)!.GetSetMethod(true)!.Invoke(instance, [propertyValue]);
};
I wrote it myself to call private setters on public properties.
Thank you
Page URL
https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization.metadata.jsonpropertyinfo.set?view=net-9.0
Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Text.Json.Serialization.Metadata/JsonPropertyInfo.xml
Document Version Independent Id
ffedbd9c-8ac4-1dee-863a-467e64ad5ff7
Article author
@dotnet-bot
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
Tagging subscribers to this area: @dotnet/area-system-text-json