From 66bb32b63ed81d4bbc26db86c269550d9ea26b11 Mon Sep 17 00:00:00 2001 From: Benjamin Litzelmann Date: Fri, 20 May 2016 20:25:39 +0900 Subject: [PATCH] Fix deserialization of generic dictionaries that use explicit implementation of the Add method --- SharpYaml/Serialization/Descriptors/DictionaryDescriptor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SharpYaml/Serialization/Descriptors/DictionaryDescriptor.cs b/SharpYaml/Serialization/Descriptors/DictionaryDescriptor.cs index 554424d..fa87ee8 100644 --- a/SharpYaml/Serialization/Descriptors/DictionaryDescriptor.cs +++ b/SharpYaml/Serialization/Descriptors/DictionaryDescriptor.cs @@ -83,15 +83,15 @@ namespace SharpYaml.Serialization.Descriptors keyType = interfaceType.GetGenericArguments()[0]; valueType = interfaceType.GetGenericArguments()[1]; IsGenericDictionary = true; - getEnumeratorGeneric = typeof (DictionaryDescriptor).GetMethod("GetGenericEnumerable").MakeGenericMethod(keyType, valueType); + getEnumeratorGeneric = typeof(DictionaryDescriptor).GetMethod("GetGenericEnumerable").MakeGenericMethod(keyType, valueType); + addMethod = interfaceType.GetMethod("Add", new[] { keyType, valueType }); } else { keyType = typeof(object); valueType = typeof(object); + addMethod = type.GetMethod("Add", new[] { keyType, valueType }); } - - addMethod = type.GetMethod("Add", new[] { keyType, valueType }); } public override void Initialize()