Table of Contents

Struct Outcome<TResult>

Namespace
Polly
Assembly
Polly.Core.dll

Represents the outcome of an operation which could be a result of type TResult or an exception.

public readonly struct Outcome<TResult>

Type Parameters

TResult

The result type of the operation.

Inherited Members

Remarks

Always use the constructor when creating this struct, otherwise we do not guarantee binary compatibility.

Properties

Exception

Gets the exception that occurred during the operation, if any.

public Exception? Exception { get; }

Property Value

Exception

Result

Gets the result of the operation, if any.

public TResult? Result { get; }

Property Value

TResult

Methods

ThrowIfException()

Throws an exception if the operation produced an exception.

public void ThrowIfException()

Remarks

If the operation produced a result, this method does nothing. The thrown exception maintains its original stack trace.

ToString()

Returns the string representation of the outcome.

public override string ToString()

Returns

string

The exception message if the outcome is an exception; otherwise, the string representation of the result.