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,751
  • 2
  • 22
  • 41

0 Answers0