示例#1
0
 /// <summary>
 /// 返回异常信息
 /// </summary>
 public static Result FromError(string message, ResultCode code = ResultCode.Fail)
 {
     return(new Result(code, message));
 }
示例#2
0
 /// <summary>
 /// 返回指定 Code
 /// </summary>
 public static Result FromCode(ResultCode code, string message = null)
 {
     return(new Result(code, message));
 }
示例#3
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="code"></param>
 /// <param name="message"></param>
 /// <param name="data"></param>
 /// <returns></returns>
 public static Result <T> FromCode <T>(ResultCode code, T data, string message = null)
 {
     return(new Result <T>(code, message, data));
 }
示例#4
0
 /// <summary>
 /// 返回结果
 /// </summary>
 /// <param name="code">状态码</param>
 /// <param name="message">提示信息</param>
 public Result(ResultCode code, string message = null)
 {
     Code    = code;
     Message = message;
 }