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:
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 Next Topiculong keyword in C# |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India