<PackageReference Include="Polly" Version="5.2.0" />

IPolicyRegistry<TKey>

public interface IPolicyRegistry<TKey>
Represents a collection of policies keyed by TKey.
int Count { get; }

Total number of policies in the registry.

IsPolicy this[TKey key] { get; set; }

Gets of sets the IsPolicy with the specified key. To retrieve a policy directly as a particular Policy type or Policy interface (avoiding a cast), use the Get<T> method.

void Add<TPolicy>(TKey key, TPolicy policy) where TPolicy : IsPolicy

Adds an element with the provided key and policy to the registry.

void Clear()

Removes all keys and policies from registry.

bool ContainsKey(TKey key)

Determines whether the specified key exists.

TPolicy Get<TPolicy>(TKey key) where TPolicy : IsPolicy

Gets the policy stored under the provided key, casting to TPolicy.

bool Remove(TKey key)

Removes the specified Policy from the registry.

bool TryGet<TPolicy>(TKey key, out TPolicy policy) where TPolicy : IsPolicy

Gets the policy stored under the provided key, casting to TPolicy.