lundi 1 août 2022

How can I check that incoming parameter is static

I have class, its constructor takes SemaphoreSlim and it must be static(if else I should throw an exception). How can I check that incoming "semaphore" parameter is static? I have tried to look through its Type, but there's no IsStatic field. The code is below

protected CacheService(SemaphoreSlim semaphore, IMemoryCache memoryCache)
{
    _semaphore = semaphore;
    _memoryCache = memoryCache;
}




Aucun commentaire:

Enregistrer un commentaire