[MVC] Web API Request 데이터를 배열로 받을때

728x90
반응형

Get 방식

[HttpGet]
public HttpResponseMessage TeamInfo([FromUri] UInt64 [] to)
{
    //to = new UInt64[100];
    string result = string.Empty;
    for ( int i = 0; i < to.Length; i++)
    {
        result += to[i].ToString();
    }
         

    var response = new HttpResponseMessage(HttpStatusCode .OK)
    {
        Content = new StringContent(result.ToString())
    };
    return response;
}
728x90