Class SequenceAllExtensions
- Namespace
- Trellis
- Assembly
- Trellis.Core.dll
Accumulating-error counterpart to Sequence<T>(IEnumerable<Result<T>>). Runs through every item; folds failures via the existing Combine(Error?, Error) extension so two Error.UnprocessableContent failures merge their fields/rules and heterogeneous failures flatten into Error.Aggregate.
public static class SequenceAllExtensions
- Inheritance
-
SequenceAllExtensions
- Inherited Members
Methods
SequenceAll(IEnumerable<Result<Unit>>)
Sequences a collection of no-payload Result<Unit> values into a single
Result<Unit>, accumulating every failure via Combine(Error?, Error).
public static Result<Unit> SequenceAll(this IEnumerable<Result<Unit>> source)
Parameters
sourceIEnumerable<Result<Unit>>Source collection of results.
Returns
- Result<Unit>
Success if every item succeeds; otherwise a failure carrying the combined error. A single failure is returned unchanged (no Error.Aggregate wrap).
Exceptions
- ArgumentNullException
Thrown when
sourceis null.
SequenceAll<T>(IEnumerable<Result<T>>)
Sequences a collection of Result<TValue> into a single result containing every value in source order. Unlike Sequence<T>(IEnumerable<Result<T>>), this overload does not short-circuit: it visits every item and folds failures via Combine(Error?, Error).
public static Result<IReadOnlyList<T>> SequenceAll<T>(this IEnumerable<Result<T>> source)
Parameters
sourceIEnumerable<Result<T>>Source collection of results.
Returns
- Result<IReadOnlyList<T>>
Success carrying every value in source order if every item succeeds; otherwise a failure carrying the combined error. A single failure is returned unchanged (no Error.Aggregate wrap).
Type Parameters
TType of value carried by each result.
Exceptions
- ArgumentNullException
Thrown when
sourceis null.