Javatpoint Logo
Javatpoint Logo

Type.FindInterfaces() Method in C#

In this article, we will discuss the Type.FindInterfaces() in C# with its syntax and examples.

What is the Type.FindInterfaces()?

The Type.FindInterfaces() function is a useful tool for retrieving a collection of interfaces implemented by a certain type. The Type.FindInterfaces() function is part of the System.Type class, which provides reflection features for examining types in runtime. It allows programmers to inspect classes, structures, enumerations, and other items to obtain information regarding the interfaces.

This function examines the base class hierarchy and returns each matching interface that each class executes, along with all matching interfaces that each of the corresponding interfaces implements. No duplicated interfaces are returned.

Syntax:

It has the following syntax:

Parameters:

  • Filters: The module that compares interfaces based on filter criteria.
  • filtersCriteria: It is thesearch criteria used to decide if an interface should be included within the returned array.

Return Value: The function returns an array of Type objects. It then filters this list of interfaces and returns an array containing the matching Type objects.

This function throws ArgumentNullException in the event that the filter is null.

Example 1:

Let us take an example to implement the Type.FindInterfaces(TypeFilter, Object) in C#:

Output:

The filtered list of the interface are: System.Collections.IEnumerable.

Example 2:

Let us take another example to implement the Type.FindInterfaces(TypeFilter, Object) in C#:

Output:

myFilterValue should not be null
The Exception is Thrown: System.ArgumentNullException






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA




news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news