【发布时间】:2016-09-10 04:47:40
【问题描述】:
我正在为我的 webapi2 文档使用 swagger。我从 github 下载了源代码并尝试根据我的要求更改源代码。但是我遇到了响应类型的问题,即我想在我的一个 get 方法上指定 responsetype 属性,所以我使用了[ResponseType(typeof(List<Student>))]( student 是我的班级,我想在模型模式中返回学生属性),但它在文档中返回 IHttpActionResult 作为模型和 null 值作为模型模式,有没有其他方法可以访问代码中的 responsetype 属性,以便我可以返回我的模型的属性...
请帮帮我...
[ResponseType(typeof(List<Student>))]
public IHttpActionResult Get()
{ //my code here
}
【问题讨论】: