I expected the following code
JsonArray.Parse("[\"cat\",\"dog\"]")[0].ToString()
to give me cat
but it actually gives me "cat"
.
Is this a bug or by design.
Interestingly there is a private value
member which does give cat
.
(((System开发者_运维问答.Json.JsonPrimitive)(JsonArray.Parse("[\"cat\",\"dog\"]")[0]))).value
will give cat
- but its private !
(JsonArray is in System.Json.dll
which for Silverlight 4 is here : C:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Json.dll)
Yes, it is by design.
http://msdn.microsoft.com/en-us/library/system.json.jsonprimitive_methods%28v=VS.95%29.aspx
ToString Saves (serializes) this JSON CLR type into text-based JSON. (Inherited from JsonValue.)
精彩评论