<PackageReference Include="System.Threading.RateLimiting" Version="11.0.0-preview.5.26302.115" />

System.Threading.RateLimiting.RateLimitLease

public abstract class RateLimitLease : IDisposable
Abstraction for leases returned by RateLimiter implementations. A lease represents the success or failure to acquire a resource and contains potential metadata that is relevant to the acquisition operation.
public abstract bool IsAcquired { get; }

Represents whether lease acquisition was successful.

public abstract IEnumerable<string> MetadataNames { get; }

Gets a list of the metadata names that are available on the lease.

protected RateLimitLease()

public void Dispose()

Dispose the lease. This may free up space on the limiter implementation the lease came from.

protected virtual void Dispose(bool disposing)

Dispose method for implementations to write.

public virtual IEnumerable<KeyValuePair<string, object>> GetAllMetadata()

Gets a list of all the metadata that is available on the lease.

public abstract bool TryGetMetadata(string metadataName, out object metadata)

Attempt to extract metadata for the lease.

public bool TryGetMetadata<T>(MetadataName<T> metadataName, out T metadata)

Attempt to extract a strongly-typed metadata for the lease.