Table of Contents

Class PolicyBuilder<TResult>

Namespace
Polly
Assembly
Polly.dll

Builder class that holds the list of current execution predicates filtering TResult result values.

public sealed class PolicyBuilder<TResult>

Type Parameters

TResult
Inheritance
PolicyBuilder<TResult>
Inherited Members
Extension Methods

Methods

OrResult(Func<TResult, bool>)

Specifies the type of result that this policy can handle with additional filters on the result.

public PolicyBuilder<TResult> OrResult(Func<TResult, bool> resultPredicate)

Parameters

resultPredicate Func<TResult, bool>

The predicate to filter the results this policy will handle.

Returns

PolicyBuilder<TResult>

The PolicyBuilder instance.

OrResult(TResult)

Specifies a result value which the policy will handle.

public PolicyBuilder<TResult> OrResult(TResult result)

Parameters

result TResult

The TResult value this policy will handle.

Returns

PolicyBuilder<TResult>

The PolicyBuilder instance.

Remarks

This policy filter matches the result value returned using .Equals(), ideally suited for value types such as int and enum. To match characteristics of class return types, consider the overload taking a result predicate.

Or<TException>()

Specifies the type of exception that this policy can handle.

public PolicyBuilder<TResult> Or<TException>() where TException : Exception

Returns

PolicyBuilder<TResult>

The PolicyBuilder instance.

Type Parameters

TException

The type of the exception to handle.

Or<TException>(Func<TException, bool>)

Specifies the type of exception that this policy can handle with additional filters on this exception type.

public PolicyBuilder<TResult> Or<TException>(Func<TException, bool> exceptionPredicate) where TException : Exception

Parameters

exceptionPredicate Func<TException, bool>

The exception predicate to filter the type of exception this policy can handle.

Returns

PolicyBuilder<TResult>

The PolicyBuilder instance.

Type Parameters

TException

The type of the exception.