Good day! This question seems easy, but I can't think out how to do it. I would pass Type parameter to function and check whether variable has that type.
void foo(Type type = ) // how to pass here default value for example System.Object?
{
if (elem.GetType() is type)
{
}
}
}
EDIT I have next classes
class Element {}
class ChildElementClass : Element {}
class SecondChildEleementClass : Element{}
And have array of Elements[], which is storing elements of all three classes
Element[] elements;
So, I would retrieve all elements for ChildElementClass. I make it by other way, but it is just interesting.