我能够从一个角度控制器调用C#方法,例如:二维数组angularjs到C#
angualarjs:
$http.post('myC#Function', { "input": input)
.success(function (response) {
console.log("success send response: " + response);
})
.error(function (response) {
console("error send response: " + response);
});
C#
public string myC#Function(string input)
{
return "success";
}
我的问题出现时,我尝试从角度传递2D阵列到C#控制器,例如:
angularjs:
var my2DArray= [[], []];
// array is populated here (not shown)
$http.post('myC#Function', { "inputArray": my2DArray)
.success(function (response) {
console.log("success send response: " + response);
})
.error(function (response) {
console("error send response: " + response);
});
C#
public string myC#Function(string[,]input)
{
return "success";
}
任何帮助将appriciated。
即时得到相同的错误对方的回答。当我尝试从c#返回输入[0] [0]时,即使填充它,我也会收到NullReferenceException错误。有任何想法吗? – sgov090
你在调试模式下的your2DArrayInCSharp中有什么?这是对的吗 ? – Floc