Table of Contents

Class ResultProblemCollection

Namespace
Olve.Results
Assembly
Olve.Results.dll

Represents a collection of problems encountered during an operation.

public class ResultProblemCollection : IEnumerable<ResultProblem>, IEnumerable
Inheritance
ResultProblemCollection
Implements
Inherited Members
Extension Methods

Constructors

ResultProblemCollection(params IEnumerable<ResultProblem>)

Represents a collection of problems encountered during an operation.

public ResultProblemCollection(params IEnumerable<ResultProblem> problems)

Parameters

problems IEnumerable<ResultProblem>

The problems encountered during the operation.

Properties

IsRetryable

Gets a value indicating whether the problems in this collection may be resolved by retrying: true if the collection is non-empty and every problem is retryable; otherwise false.

public bool IsRetryable { get; }

Property Value

bool

Methods

Append(params IEnumerable<ResultProblem>)

Appends the specified problems to the collection.

public ResultProblemCollection Append(params IEnumerable<ResultProblem> resultProblems)

Parameters

resultProblems IEnumerable<ResultProblem>

The problems to append.

Returns

ResultProblemCollection

A new collection with the specified problems appended.

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<ResultProblem> GetEnumerator()

Returns

IEnumerator<ResultProblem>

An enumerator that can be used to iterate through the collection.

Merge(params IEnumerable<ResultProblemCollection>)

Merges multiple problem collections together into a single collection.

public static ResultProblemCollection Merge(params IEnumerable<ResultProblemCollection> problemCollections)

Parameters

problemCollections IEnumerable<ResultProblemCollection>

The problem collections to merge.

Returns

ResultProblemCollection

A new collection containing all problems from the specified collections.

PickProblems<TProblem>()

Gets all problems assignable to TProblem, in enumeration order.

public IEnumerable<TProblem> PickProblems<TProblem>() where TProblem : ResultProblem

Returns

IEnumerable<TProblem>

The matching problems, or an empty sequence if there are none.

Type Parameters

TProblem

The problem type to look for, typically a subclass of ResultProblem.

Prepend(bool, Exception, string, params object[])

Prepends a new problem from an exception to the collection using a formatted message, adding context to the existing problems.

public ResultProblemCollection Prepend(bool retryable, Exception exception, string message, params object[] args)

Parameters

retryable bool

Whether the new problem is retryable.

exception Exception

The exception causing the problem.

message string

The format string for the problem message.

args object[]

The arguments to format the message.

Returns

ResultProblemCollection

A new collection with the formatted problem prepended.

Prepend(bool, string, params object[])

Prepends a new problem to the collection using a formatted message, adding context to the existing problems.

public ResultProblemCollection Prepend(bool retryable, string message, params object[] args)

Parameters

retryable bool

Whether the new problem is retryable.

message string

The format string for the problem message.

args object[]

The arguments to format the message.

Returns

ResultProblemCollection

A new collection with the formatted problem prepended.

Prepend(params IEnumerable<ResultProblem>)

Prepends the specified problems to the collection.

public ResultProblemCollection Prepend(params IEnumerable<ResultProblem> resultProblems)

Parameters

resultProblems IEnumerable<ResultProblem>

The problems to prepend.

Returns

ResultProblemCollection

A new collection with the specified problems prepended.

Prepend(Exception, string, params object[])

Prepends a new problem from an exception to the collection using a formatted message, adding context to the existing problems. The new problem inherits IsRetryable from this collection.

public ResultProblemCollection Prepend(Exception exception, string message, params object[] args)

Parameters

exception Exception

The exception causing the problem.

message string

The format string for the problem message.

args object[]

The arguments to format the message.

Returns

ResultProblemCollection

A new collection with the formatted problem prepended.

Prepend(string, params object[])

Prepends a new problem to the collection using a formatted message, adding context to the existing problems. The new problem inherits IsRetryable from this collection.

public ResultProblemCollection Prepend(string message, params object[] args)

Parameters

message string

The format string for the problem message.

args object[]

The arguments to format the message.

Returns

ResultProblemCollection

A new collection with the formatted problem prepended.

TryPickProblem<TProblem>(out TProblem?)

Attempts to retrieve the first problem assignable to TProblem, in enumeration order.

public bool TryPickProblem<TProblem>(out TProblem? problem) where TProblem : ResultProblem

Parameters

problem TProblem

When this method returns true, contains the first matching problem. Otherwise, null.

Returns

bool

true if a matching problem exists; otherwise, false.

Type Parameters

TProblem

The problem type to look for, typically a subclass of ResultProblem.