-Fixed List<T> silly buggers with nullable types - http://tinyurl.com/yagsptj - That was tough!

This commit is contained in:
JamesNK
2009-10-03 07:54:47 +00:00
parent be8d951c03
commit a5b7507d17
5 changed files with 31 additions and 12 deletions
@@ -525,7 +525,7 @@ namespace Newtonsoft.Json.Utilities
// can't add or modify a readonly list
// use List<T> and convert once populated
list = (IList)CreateGenericList(readOnlyCollectionContentsType);
list = CreateGenericList(readOnlyCollectionContentsType);
isReadOnlyOrFixedSize = true;
}
else if (typeof(IList).IsAssignableFrom(listType))
@@ -537,9 +537,9 @@ namespace Newtonsoft.Json.Utilities
else
list = null;
}
else if (listType.IsGenericType && listType.GetGenericTypeDefinition() == typeof(IList<>))
else if (ReflectionUtils.ImplementsGenericDefinition(listType, typeof(IList<>)))
{
list = CollectionUtils.CreateGenericList(ReflectionUtils.GetCollectionItemType(listType));
list = CreateGenericList(ReflectionUtils.GetCollectionItemType(listType));
}
else
{