Polly.Policy.WithPolicyKey C# (CSharp) Method

WithPolicyKey() public method

Sets the PolicyKey for this Policy instance. Must be called before the policy is first used. Can only be set once.
public WithPolicyKey ( String policyKey ) : Policy
policyKey String The unique, used-definable key to assign to this instance.
return Policy
        public Policy WithPolicyKey(String policyKey)
        {
            if (_policyKey != null) throw new ArgumentException("For thread-safety reasons, PolicyKey cannot be set more than once on a Policy instance; or if the default value is being used, cannot be set after the PolicyKey property has been accessed.", nameof(policyKey));

            _policyKey = policyKey;
            return this;
        }