I've got a scenario in which I need to deserialize a sequence of maps to IEnumerable<KeyValuePair<string, string>> that wouldn't be solved by simply using Dictionary<string, string> instead. Since, apparently, YamlDotNet doesn't support KeyValuePair<,> out of the box, what alternative solutions could I rely on?
Example YAML:
- key1: value1
- key2: value2
- key3: value3
The issue here states that
KeyValuePair<,>isn't, nor is it going to be, supported, according to aaubry, the owner of YamlDotNet. Yet, he does further state, in his response under the same issue, that it can be easily implemented by adding a customINodeDeserializer. Since the example he included isn't applicable, however, I'll provide a more accurate implementation here.Now you can register your custom
INodeDeserializerlike below: