dotnet/runtime
Support using any dictionary as JsonExtensionData
Aberta
#31.645 aberto em 3 de fev. de 2020
area-System.Text.Jsonenhancementhelp wantedwishlist
Métricas do repositório
- Stars
- (17.886 estrelas)
- Métricas de merge de PR
- (Métricas PR pendentes)
Description
IMHO, IReadOnlyDictionary should work identical to IDictionary when using with JsonExtensionData attribute.
[JsonExtensionData]
public IReadOnlyDictionary<string, JsonElement> Payload { get; set; }
Currently it fails with error:
System.InvalidOperationException: The data extension property 'Payload' does not match the required signature of IDictionary<string, JsonElement> or IDictionary<string, object>.
This is analogous to collection properties which can be defined as List<T>, IList<T> or IReadOnlyList<T> etc.