How Web API returns multiple types
问题 I am just wondering whether it is possible to return multiple types in a single Web Api. For example, I want an api to return both lists of customers and orders (these two sets of data may or may not relate to each other? 回答1: To return multiple types, you can wrap them into anonymous type, there are two possible approaches: public HttpResponseMessage Get() { var listInt = new List<int>() { 1, 2 }; var listString = new List<string>() { "a", "b" }; return ControllerContext.Request