且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ActionResult< IEnumerable< T>必须返回List< T>.

更新时间:2022-03-13 15:02:53

从msdn中获取此文档: https ://docs.microsoft.com/zh-cn/aspnet/core/web-api/action-return-types?view = aspnetcore-2.1#actionresultt-type

Take this documentation from msdn: https://docs.microsoft.com/en-us/aspnet/core/web-api/action-return-types?view=aspnetcore-2.1#actionresultt-type

C#不支持接口上的隐式强制转换运算符. 因此,将接口转换为具体类型是 必须使用ActionResult<T>.

C# doesn't support implicit cast operators on interfaces. Consequently, conversion of the interface to a concrete type is necessary to use ActionResult<T>.