KestrunLockRegistry.TryGet method

Attempts to get the semaphore associated with the specified key without creating a new one if it doesn’t exist.

public static bool TryGet(string key, out SemaphoreSlim? semaphore)
parameter description
key The resource key.
semaphore The semaphore associated with the specified key, if it exists.

Return Value

True if the semaphore exists; otherwise, false.

Exceptions

exception condition
ArgumentException Thrown when key is empty, or whitespace.
ArgumentNullException Thrown when key is null.

See Also