I am testing the object as follows:
if (item is IDictionary<object, object>)
But this does not match all the other combinations of types <sting, object>, <int, string> , etc.
I just want to know if it implemented an interface no matter what generic types it uses.
I found an example that said it is possible to do something like:
dictionary.GetType().GetInterfaces().Any(x => x.GetGenericTypeDefinition == typeof(IDictionary<>));
But I still need to specify a type signature or invalid.
Is it possible to make an operator that checks the interface without specifying a type?
source share