Type.FindInterfaces(TypeFilter, Object) Method is used to return an array of Type objects which represents a filtered list of interfaces implemented or inherited by the current Type. All of the interfaces implemented by this class are considered during the search, whether declared by a base class or this class itself.
This method searches the base class hierarchy, returning each of the matching interfaces each class implements as well as all the matching interfaces each of those interfaces implements (that is, the transitive closure of the matching interfaces is returned). No duplicate interfaces are returned.
public virtual Type FindInterfaces (System.Reflection.TypeFilter filter, object filterCriteria);
- filter: The delegate which compares the interfaces against filterCriteria.
- filterCriteria: The search criteria which determines whether an interface should be included in the returned array.
Return Value: This method returns an array of Type objects representing a filtered list of the interfaces implemented or inherited by the current Type, or an empty array of type Type if no interfaces matching the filter are implemented or inherited by the current Type.
Exception: This method throws ArgumentNullException if filter is null.
Below programs illustrate the use of the above-discussed method:
filtered list of interface : System.Collections.IEnumerable.
myFilter should not be null Exception Thrown: System.ArgumentNullException