Hello,
I want to use this code to grab all methods from the assembly "Mscorlib.dll" but i get this error
"Unable to cast object of type 'System.Reflection.RuntimeConstructorInfo' to type 'System.Reflection.MethodInfo'."
Basically all I want to do is get a list of interfaces or Members of that assembly.
Heres the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace ConsoleApplication1 {
class Program
{
static void Main(string[] args)
{
Assembly a = Assembly.Load("Mscorlib.dll");
foreach (Type oType in a.GetTypes())
{
MemberInfo[] f = oType.GetMembers();
foreach (MethodInfo m in f)
Console.WriteLine("Member: {0}",m.ToString());
}
}
}
}
What do you think?