The generic dictionary is as follows:
public class ConcurrentDictionary<TKey, TValue> : IDictionary<TKey, TValue>
And specific dictionaries can be as follows:
var container = new ConcurrentDictionary<string, Unit>();
var container = new ConcurrentDictionary<string, CustomUnitClass>();
So, how can I check if some dictionary is of generic dictionary type?
object obj = GetObj(); // obj is some of many dictionaries
if(obj is ?)
Thank you in advance.
is an ‘open generic type’, and you cannot have instances of open generic types.
However, if you want to know whether the given object is a dictionary which has generic type parameters, you can use reflection to determine that: