Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add support for deserializing Char types

* JsonSerializationReader.cs: Add Char type to the switch. Reads the
  content as a string and validates its length
  • Loading branch information...
commit 778694e1b85416a3abfdac4952dd85c8384e1cf8 1 parent 4a6ea9c
Andreia Gaita authored
View
5 mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog
@@ -1,5 +1,10 @@
2010-07-27 Andreia Gaita <avidigal@novell.com>
+ * JsonSerializationReader.cs: Add Char type to the switch. Reads the
+ content as a string and validates its length
+
+2010-07-27 Andreia Gaita <avidigal@novell.com>
+
* JsonSerializationReader.cs, JsonSerializationWriter.cs:
Add a special case for IDictionary, since KeyValuePair objects
have private setters and can't be processed via the normal
View
5 mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs
@@ -86,6 +86,11 @@ public object ReadObject (Type type)
}
else
return reader.ReadElementContentAsString ();
+ case TypeCode.Char:
+ var c = reader.ReadElementContentAsString ();
+ if (c.Length > 1)
+ throw new XmlException ("Invalid JSON char");
+ return Char.Parse(c);
case TypeCode.Single:
return reader.ReadElementContentAsFloat ();
case TypeCode.Double:
Please sign in to comment.
Something went wrong with that request. Please try again.