Permalink
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...
shana committed Jul 27, 2010
1 parent 4a6ea9c commit 778694e1b85416a3abfdac4952dd85c8384e1cf8
@@ -1,3 +1,8 @@
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:
@@ -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:

0 comments on commit 778694e

Please sign in to comment.