-Added support for enum values to LINQ to JSON
-Added TypeNameAssemblyFormat property to JsonSerializer. Property controls whether .NET type names are written with a full or partial assembly name -Added TypeNameHandling to JsonProperty attribute. Allows a type names to be included on an individual property basis -Fixed serializing HashSet<T> -Additional permission demands added to DynamicCodeGeneration flag
This commit is contained in:
@@ -473,7 +473,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
public static IList CreateAndPopulateList(Type listType, Action<IList, bool> populateList)
|
||||
public static object CreateAndPopulateList(Type listType, Action<IList, bool> populateList)
|
||||
{
|
||||
ValidationUtils.ArgumentNotNull(listType, "listType");
|
||||
ValidationUtils.ArgumentNotNull(populateList, "populateList");
|
||||
@@ -526,9 +526,12 @@ namespace Newtonsoft.Json.Utilities
|
||||
else
|
||||
list = null;
|
||||
}
|
||||
else if (ReflectionUtils.ImplementsGenericDefinition(listType, typeof(IList<>)))
|
||||
else if (ReflectionUtils.ImplementsGenericDefinition(listType, typeof(ICollection<>)))
|
||||
{
|
||||
list = CreateGenericList(ReflectionUtils.GetCollectionItemType(listType));
|
||||
if (ReflectionUtils.IsInstantiatableType(listType))
|
||||
list = CreateCollectionWrapper(Activator.CreateInstance(listType));
|
||||
else
|
||||
list = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -548,6 +551,10 @@ namespace Newtonsoft.Json.Utilities
|
||||
else if (ReflectionUtils.InheritsGenericDefinition(listType, typeof(ReadOnlyCollection<>)))
|
||||
list = (IList)ReflectionUtils.CreateInstance(listType, list);
|
||||
}
|
||||
else if (list is IWrappedCollection)
|
||||
{
|
||||
return ((IWrappedCollection) list).UnderlyingCollection;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user