我想向我的控制器传递两个System.Drawing.Point结构体。虽然可以创建普通对象来简单地获取位置,但我很好奇是否可以使用内置的结构体来完成相同的任务。
我尝试使用以下签名,但无法触发任何断点:
public async Task<ActionResult> DoSomething(Point pt1, Point pt2)
并且
public async Task<ActionResult> DoSomething(Point pt)
我在这个标记处设置了断点,
public async Task<ActionResult> DoSomething(Point[] pts)
使用此请求:
$.ajax({
type: 'GET',
url: 'http://localhost:37260/TestController/DoSomething',
dataType: 'application/json',
success: function (myData) { },
data: [{X: 5, Y: 6}, {X: 7, Y: 9}],
async: false
});
但是得分为零。我也尝试了很多其他的方法。 我正在使用jQuery和JSON,但这不是必需的。此外,可以是POST或GET请求。