'Need to check both condition token not in cache plus token expires less than utc now
Below code throwing argument null exception for token.ExpiresOn since token is not in cache and null. Is there way to check both in IF clause - token not in cache plus token expires less than utc now?
if (!_cache.TryGetValue("KEY", out TokenClass token) && token.ExpiresOn < DateTimeOffset.UtcNow)
{
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
