我能夠從一個角度控制器調用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