Checking if a given Type implements a specific interface

There is possibly a framework method to do this but… private bool IsInterfaceImplemented(Type typeToCheck, Type interfaceToFind){Type[] interfaces = typeToCheck.GetInterfaces();foreach (Type iface in interfaces){if (iface == interfaceToFind){return true;}}return false;}

SHARE:

Add comment

Loading