【发布时间】:2022-01-06 16:15:36
【问题描述】:
我正在尝试将矩阵数组作为参数传递给 API,看来我没有以正确的方式传递参数。
[HttpPost(Name = "Post")]
public IActionResult Post([FromBody]int[,] matrixValues)
{
}
我将参数作为请求体从 swagger UI 传递
[
{1,0,1,1,1},{1,0,0,0,0 },{1,0,0,0,1},{0,0,1,0,0},{0,1,0,0,0},{1,1,0,0,1}
]
它正在抛出
System.NotSupportedException: The type 'System.Int32[,]' is not supported.
.Net 核心 API 中有什么方法可以接受矩阵头吗?
【问题讨论】:
-
忘掉招摇,每一秒都在抱怨。
标签: c# matrix asp.net-core-webapi