I’m building a project. It’s an application that users can add their extensions (DLL files) to. To manage an extension, I need to get its list of classes, functions, etc. Is there code for doing it?
Note: I am using C#.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For a particular assembly, you can use
Assembly.GetTypesto get the types, then for each type callType.GetMethods(),Type.GetProperties()etc, or justType.GetMembers().However, for plugin functionality it’s usually a good idea to have a common interface which the plugins have to implement – that reduces the amount of reflection you need to use. Use
Type.IsAssignableFrom()to check whether a type is compatible with a particular interface.You might also want to look at the Managed Extensibility Framework which can make implementing an extension system easier.