Search interface, specifying whether to do a case-insensitive search for the interface name in CSharp
Description
The following code shows how to search interface, specifying whether to do a case-insensitive search for the interface name.
Example
using System;//from w w w . ja v a 2 s . c o m
using System.Security;
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 'IEnumerable' Interface");
arrayMethodInfo = objType.GetInterface("ienumerable", true).GetMethods();
for (int index = 0; index < arrayMethodInfo.Length; index++)
Console.WriteLine(arrayMethodInfo[index].ToString());
}
}
The code above generates the following result.