Skip to content

Commit

Permalink
Add constructor to ValidationResult that can be used to combine other…
Browse files Browse the repository at this point in the history
… ValidationResults (#2125)
  • Loading branch information
JeremySkinner committed Aug 8, 2023
1 parent ea6979f commit 1f9102d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/FluentValidation/Results/ValidationResult.cs
Expand Up @@ -74,6 +74,14 @@ public class ValidationResult {
_errors = failures.Where(failure => failure != null).ToList();
}

/// <summary>
/// Creates a new ValidationResult by combining several other ValidationResults.
/// </summary>
/// <param name="otherResults"></param>
public ValidationResult(IEnumerable<ValidationResult> otherResults) {
_errors = otherResults.SelectMany(x => x.Errors).ToList();
}

internal ValidationResult(List<ValidationFailure> errors) {
_errors = errors;
}
Expand Down

0 comments on commit 1f9102d

Please sign in to comment.