Replies: 4 comments
-
The desire for this is that:
I want that to be valid so I want the type as part of the key:
Now there is no problem.
|
Beta Was this translation helpful? Give feedback.
-
Your going to need to build your own type descriminator for that. They’re relatively easy to implement. I think you will be able to get at what you need to be able to do this. |
Beta Was this translation helpful? Give feedback.
-
Thank you. I will delve into the existing extension method to configure type descrimination and see what I can work out. It will be a few days before I can do this, any pertinent information around implementation is most welcome otherwise I will update here if I solve it. |
Beta Was this translation helpful? Give feedback.
-
I am guessing I would need to aim for something like this:
|
Beta Was this translation helpful? Give feedback.
-
I'd like to deserialize some yaml into a type that has a polymorphic dictionary property.
I'd like to implement a scheme where by, when deserializing
dictionary<string, BaseType>
I'd like to select the concrete type based on the dictionary key value.It's not just a straight forward mapping however- I need to run some logic on the key value.
So here I my type has a property called
MyDictionary
which is aDictionary<string, BaseType>
. I'd like to analyse / map the value of the key after the@
to work out what type should be selected for deseriliazation. Is this possible?The docs suggest it may not be.
Beta Was this translation helpful? Give feedback.
All reactions