Click to See Complete Forum and Search --> : Getting Interfaces and Methods from DLL
slewrate
September 14th, 2009, 01:15 PM
Hello, I have a DLL that contains several interfaces. I am trying to get the function signatures of all the functions that are implemented in these interfaces.
If anybody could show me an easy way how to do this right, I would really appreciate it.
monalin
September 15th, 2009, 10:15 AM
Try to download RedGate's .NET Reflector you can get a free version of it off download.com.
slewrate
September 15th, 2009, 02:16 PM
well, you see, I have something like this:
Assembly asm = Assembly.LoadFile("mydll.dll");
attributes = asm.GetExportedTypes();
foreach (Type type in typelist)
{
rt.Text += type.ToString();
MemberInfo[] memlist = type.GetMembers();
rt.Text += "------Members-----";
rt.Text += "\n";
foreach (MemberInfo mem in memlist)
{
rt.Text += mem.ToString();
}
}
This gives me pretty much what I want, however, I figured that some of the interfaces do have base types and I can't read them.
Any suggestions ?
monalin
September 15th, 2009, 02:57 PM
Well you'll need to check the BindingFlags parameter of type.GetMembers(). It filters out a lot of the members and properties etc... if you just leave it with the default value.
slewrate
September 15th, 2009, 03:30 PM
Yea, I played around with that. No luck.
monalin
September 15th, 2009, 03:59 PM
If you want the base class members do this
type.BaseType.GetMembers()
slewrate
September 15th, 2009, 04:27 PM
Thanks for your help. My problem was that I was actually not looking for a base type but rather a sub type.
Thanks for your help though.
MadHatter
September 15th, 2009, 10:03 PM
reflector will give you types derived from your interfaces (assuming they're in the dll you're speaking of).
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.