插件化编程之WebAPI统一返回模型( 三 )

/// 异常/// /// /// <summary>/// 泛型类 返回模型/// </summary>/// <typeparam name="T"></typeparam>public class ResultListDto<T> : ResultDto, IResultListDto<T>{/// <summary>/// 常规数据/// </summary>public new List<T> Data { get; set; }/// <summary>/// 成功/// </summary>/// <param name="data"></param>/// <param name="msg"></param>/// <returns></returns>public ResultListDto<T> Success(List<T> data = https://www.huyubaike.com/biancheng/default, string msg ="success"){this.Code = (int)EnumCode.Succeed;this.Successful = true;this.Data = https://www.huyubaike.com/biancheng/data;this.Msg = msg;return this;}/// /// 异常/// /// 顺着这个思路,我们可以继续实现分页,多参数返回等等,如果你觉得麻烦,当然也可以直接在nuget直接引用 Sy.ResultExtension,这个组件,苦逼的码农小哥已经为你实现了该功能 。

推荐阅读