1

I have the classes

abstract class MyGeneric<T>
{
    ...
}

class A : MyGeneric<int>
{
    ...
}

How can I check, using the is operator, if any object is an instance of class MyGeneric?

Something like this:

bool isGeneric = anyObj.GetType() is MyGeneric;
Christian St.
  • 1,657
  • 2
  • 19
  • 40

0 Answers0