If I have a templated(generic) class MyClass<T>, is it possible to do something like:
var b = someObject is MyClass; // without specifying <T>
No it's not, but you can use reflection to check the type:
someObject.GetType().GetGenericTypeDefinition().IsAssignableFrom(typeof(MyClass<>))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With