Mega Code Archive

 
Categories / C# / Reflection
 

Searches for the interface with the specified name

using System; using System.Reflection; using System.Collections.Generic; using System.Collections; public class Test {     public static void Main()     {         Hashtable hashtableObj = new Hashtable();         Type objType = hashtableObj.GetType();         MemberInfo[] arrayMemberInfo;         MethodInfo[] arrayMethodInfo;         arrayMethodInfo = objType.GetInterface("IDeserializationCallback").GetMethods();         for (int index = 0; index < arrayMethodInfo.Length; index++)             Console.WriteLine(arrayMethodInfo[index].ToString());         InterfaceMapping interfaceMappingObj;         interfaceMappingObj = objType.GetInterfaceMap(typeof(IDictionary));         arrayMemberInfo = interfaceMappingObj.InterfaceMethods;         for (int index = 0; index < arrayMemberInfo.Length; index++)             Console.WriteLine(arrayMemberInfo[index].ToString());     } }