Ver código fonte

2009-12-08 Chris Toshok <[email protected]>

	* JsonSerializationReader.cs (DeserializeGenericCollection): in
	the 2.1 case we still need to convert the List<> to an array.

svn path=/trunk/mcs/; revision=147835
Chris Toshok 16 anos atrás
pai
commit
4e5653512f

+ 5 - 0
mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog

@@ -1,3 +1,8 @@
+2009-12-08  Chris Toshok  <[email protected]>
+
+	* JsonSerializationReader.cs (DeserializeGenericCollection): in
+	the 2.1 case we still need to convert the List<> to an array.
+
 2009-12-07  Chris Toshok  <[email protected]>
 
 	* JsonReaderWriterFactory.cs (CreateJsonReader): pass null for the

+ 7 - 1
mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs

@@ -256,7 +256,13 @@ namespace System.Runtime.Serialization.Json
 					c.Add (elem);
 				}
 #if NET_2_1
-				ret = c;
+				if (collectionType.IsArray) {
+					Array array = Array.CreateInstance (elementType, c.Count);
+					c.CopyTo (array, 0);
+					ret = array;
+				}
+				else
+					ret = c;
 #else
 				ret = collectionType.IsArray ? ((ArrayList) c).ToArray (elementType) : c;
 #endif