/// <summary> /// 返回异常信息 /// </summary> public static Result FromError(string message, ResultCode code = ResultCode.Fail) { return(new Result(code, message)); }
/// <summary> /// 返回指定 Code /// </summary> public static Result FromCode(ResultCode code, string message = null) { return(new Result(code, message)); }
/// <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)); }
/// <summary> /// 返回结果 /// </summary> /// <param name="code">状态码</param> /// <param name="message">提示信息</param> public Result(ResultCode code, string message = null) { Code = code; Message = message; }