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;
1
  • You should not .GetType() before checking. Commented Jan 7, 2015 at 13:40

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.