I'm trying to check if some Type
is instance of another Type
. Like in this simple method, the best option would be:
bool Example(Type instance, Type runtimeKnwownType) {
return instance is runtimeKnwownType;
}
It is the best option because is
works with interfaces, however it doesn't work with Type
and not constant right operand. Another option is Type.IsSubclassOf(object)
doesn't work with interfaces. So there is my question for substition of is
in this scenario.
Aucun commentaire:
Enregistrer un commentaire