Exemple #1
0
        protected Result(bool isSuccess, ErrorTypebase errorType)
        {
            if (isSuccess && errorType != null)
            {
                throw new InvalidOperationException();
            }
            if (!isSuccess && errorType == null)
            {
                throw new InvalidOperationException();
            }

            IsSuccess = isSuccess;
            ErrorType = errorType;
        }
Exemple #2
0
 public static Result <T> Fail <T>(ErrorTypebase errorType)
 {
     return(new Result <T>(default(T), false, errorType));
 }
Exemple #3
0
 public static Result Fail(ErrorTypebase errorType)
 {
     return(new Result(false, errorType));
 }