C# TypeInfo GetInterface(String)
Description
TypeInfo GetInterface(String)
Searches for the interface
with the specified name.
Syntax
TypeInfo.GetInterface(String)
has the following syntax.
public Type GetInterface(
string name
)
Parameters
TypeInfo.GetInterface(String)
has the following parameters.
name
- The string containing the name of the interface to get. For generic interfaces, this is the mangled name.
Returns
TypeInfo.GetInterface(String)
method returns An object representing the interface with the specified name, implemented
or inherited by the current Type, if found; otherwise, null.
Example
using System;/*w ww . j a va2 s. c o m*/
using System.Reflection;
using System.Collections;
public class MainClass
{
public static void Main()
{
Hashtable hashtableObj = new Hashtable();
Type objType = hashtableObj.GetType();
MethodInfo[] arrayMethodInfo;
arrayMethodInfo = objType.GetInterface("IDeserializationCallback").GetMethods();
Console.WriteLine("\nMethods of 'IDeserializationCallback' Interface :");
for (int index = 0; index < arrayMethodInfo.Length; index++)
Console.WriteLine(arrayMethodInfo[index].ToString());
}
}
The code above generates the following result.