在本教程中:http://www.asp.net/web-api/videos/getting-started/custom-validation Jon使用
dynamic error = new JsonObject();
Run Code Online (Sandbox Code Playgroud)
同
using System.Json;
Run Code Online (Sandbox Code Playgroud)
我猜这是JsonObject:http : //msdn.microsoft.com/en-us/library/system.json.jsonobject( v=vs.110) .aspx位于:
我已经添加了System.Runtime.Serialization引用但仍无法找到System.Json.
我读微软的文档错了吗?(我使用的是.NET 4.5)
我复制了以下代码:
protected override bool CanWriteType(Type type)
{
// don't serialize JsonValue structure use default for that
if (type == typeof(JsonValue) || type == typeof(JsonObject) || type == typeof(JsonArray))
return false;
return true;
}
protected override bool CanReadType(Type type)
{
if (type == typeof(IKeyValueModel))
return false;
return true;
}
Run Code Online (Sandbox Code Playgroud)
在这里,JsonValue,JsonObject,JsonArray,IKeyValueModel需要System.Json dll,它在.net 4.5框架中不可用.
我已经将nuget包更新到5.0,但仍然是那个dll不可用.任何人都可以直接给我dll或者可以给我System.Json dll的步骤?
我曾尝试使用Silverlight的System.Json.dll,但它根本不起作用