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

PolicyRegistry

public class PolicyRegistry : IPolicyRegistry<string>, IReadOnlyPolicyRegistry<string>
Stores a registry of String and Policy pair.
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()

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.

public bool Remove(string key)

Removes the stored Policy under 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.