-
September 14th, 2009, 01:15 PM
#1
Getting Interfaces and Methods from DLL
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.
-
September 15th, 2009, 10:15 AM
#2
Re: Getting Interfaces and Methods from DLL
Try to download RedGate's .NET Reflector you can get a free version of it off download.com.
-
September 15th, 2009, 02:16 PM
#3
Re: Getting Interfaces and Methods from DLL
well, you see, I have something like this:
Code:
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 ?
-
September 15th, 2009, 02:57 PM
#4
Re: Getting Interfaces and Methods from DLL
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.
-
September 15th, 2009, 03:30 PM
#5
Re: Getting Interfaces and Methods from DLL
Yea, I played around with that. No luck.
-
September 15th, 2009, 03:59 PM
#6
Re: Getting Interfaces and Methods from DLL
If you want the base class members do this
Code:
type.BaseType.GetMembers()
-
September 15th, 2009, 04:27 PM
#7
Re: Getting Interfaces and Methods from DLL
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.
-
September 15th, 2009, 10:03 PM
#8
Re: Getting Interfaces and Methods from DLL
reflector will give you types derived from your interfaces (assuming they're in the dll you're speaking of).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|