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

PolicyRegistry

Stores a registry of String and policy pairs.
public int Count { get; }

Total number of policies in the registry.

public IsPolicy this[string 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.

public PolicyRegistry(IDictionary<string, IsPolicy> registry = null)

A registry of policy policies with String keys.

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

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

public void Clear()

Removes all keys and policies from registry.

public bool ContainsKey(string key)

Determines whether the specified key exists.

public TPolicy Get<TPolicy>(string key) where TPolicy : IsPolicy

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

Returns an enumerator that iterates through the policy objects in the PolicyRegistry.

public bool Remove(string key)

Removes the policy stored under the specified key from the registry.

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

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