문제

Is it possible to pass a jagged array to a web API method? For example:

public IEnumerable<Object> Get([FromUri]int[][] jaggedArray)

How would I be able to to pass a value for jaggedArray in my web request? The parameter doesn't necessarily have to be [FromUri]

도움이 되었습니까?

해결책

I managed to figure it out. The parameter can be passed using the following format:

http://www.example.com/api/endPoint?jaggedArray[0][]=406&jaggedArray[0][]=404&jaggedArray[1][]=405&jaggedArray[1][]=407

This causes a jagged array containing two arrays, each with two numbers (406 and 404 for the first, then 405 and 407 for the second,) to be received.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top