开发者

JSON Nullable Deserialization Error

Suppose you have a simple struct,开发者_如何学运维 like so:

public struct Point
{
    public int X { get; set; }
    public int Y { get; set; }
}

And a sample class like so:

public class Map
{
    public int ID { get; set; }
    public Point? PointA { get; set; }
    ///...
}

Now, suppose you are passing Map via AJAX as JSON. Question, what value should be passed for the not null scenario?

It may matter that JavaScriptSerializer is being used in a C# 3.5 ASP.NET ASMX web service.


The issue is what I listed in my comment about the question. The automatic properties were the issue. I converted the property and the issue was resolved.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜