Table of Contents

Class ResultEnumerableExtensions

Namespace
Olve.Results
Assembly
Olve.Results.dll

Extension methods for working with Result, Result, and Result<T> collections.

public static class ResultEnumerableExtensions
Inheritance
ResultEnumerableExtensions
Inherited Members

Methods

GetProblems(IEnumerable<Result>)

Retrieves all problems from the results in the collection.

public static IEnumerable<ResultProblem> GetProblems(this IEnumerable<Result> results)

Parameters

results IEnumerable<Result>

The collection of Result objects.

Returns

IEnumerable<ResultProblem>

An IEnumerable<T> of ResultProblem objects from the failed results.

GetProblems<T>(IEnumerable<Result<T>>)

Retrieves all problems from the results in the collection.

public static IEnumerable<ResultProblem> GetProblems<T>(this IEnumerable<Result<T>> results)

Parameters

results IEnumerable<Result<T>>

The collection of Result<T> objects.

Returns

IEnumerable<ResultProblem>

An IEnumerable<T> of ResultProblem objects from the failed results.

Type Parameters

T

The type of the result value.

GetValues<T>(IEnumerable<Result<T>>)

Retrieves all successful result values from the collection.

public static IEnumerable<T> GetValues<T>(this IEnumerable<Result<T>> results)

Parameters

results IEnumerable<Result<T>>

The collection of Result<T> objects.

Returns

IEnumerable<T>

An IEnumerable<T> of successful result values.

Type Parameters

T

The type of the result value.

HasProblems(IEnumerable<Result>)

Determines whether any of the results in the collection indicate failure.

public static bool HasProblems(this IEnumerable<Result> results)

Parameters

results IEnumerable<Result>

The collection of Result objects.

Returns

bool

true if any result in the collection failed; otherwise, false.

HasProblems<T>(IEnumerable<Result<T>>)

Determines whether any of the results in the collection indicate failure.

public static bool HasProblems<T>(this IEnumerable<Result<T>> results)

Parameters

results IEnumerable<Result<T>>

The collection of Result<T> objects.

Returns

bool

true if any result in the collection failed; otherwise, false.

Type Parameters

T

The type of the result value.

TryPickProblems(IEnumerable<Result>, out ResultProblemCollection?)

Attempts to collect problems from the results in the collection.

public static bool TryPickProblems(this IEnumerable<Result> results, out ResultProblemCollection? problems)

Parameters

results IEnumerable<Result>

The collection of Result objects.

problems ResultProblemCollection

When this method returns, contains a ResultProblemCollection that includes all problems found in the failed results. If the collection had no problems, this parameter is set to null.

Returns

bool

true if any result in the collection had problems; otherwise, false.

TryPickProblems<T>(IEnumerable<Result<T>>, out ResultProblemCollection?)

Attempts to collect problems from the results in the collection.

public static bool TryPickProblems<T>(this IEnumerable<Result<T>> results, out ResultProblemCollection? problems)

Parameters

results IEnumerable<Result<T>>

The collection of Result<T> objects.

problems ResultProblemCollection

When this method returns, contains a ResultProblemCollection that includes all problems found in the failed results. If the collection had no problems, this parameter is set to null.

Returns

bool

true if any result in the collection had problems; otherwise, false.

Type Parameters

T

The type of the result value.

TryPickProblems<T>(IEnumerable<Result<T>>, out ResultProblemCollection?, out IList<T>?)

Attempts to collect problems and successful values from the results in the collection.

public static bool TryPickProblems<T>(this IEnumerable<Result<T>> results, out ResultProblemCollection? problems, out IList<T>? values)

Parameters

results IEnumerable<Result<T>>

The collection of Result<T> objects.

problems ResultProblemCollection

When this method returns, contains a ResultProblemCollection that includes all problems found in the failed results. If the collection had no problems, this parameter is set to null.

values IList<T>

When this method returns, contains a collection of successful result values. If no results were successful, this parameter is set to null.

Returns

bool

true if any result in the collection had problems; otherwise, false.

Type Parameters

T

The type of the result value.