Reflection to query non-referenced assembly

  • Thread starter Thread starter Jimi
  • Start date Start date
J

Jimi

What do I need to do to get details of an assembly that is not
referenced by an app? I don't even know the classes contained in the
assembly.

If the assembly is referenced and I know the existing classes, I know
I can do:
System.Reflection.MemberInfo[] ClassMemberInfo =
typeof(SomeClass).GetMembers()

but suppose I don't know the classes and also am not referencing the
assembly? I'd like to be able to find all the public members of the
assembly.
 
Jimi said:
What do I need to do to get details of an assembly that is not
referenced by an app? I don't even know the classes contained in the
assembly.

If the assembly is referenced and I know the existing classes, I know
I can do:
System.Reflection.MemberInfo[] ClassMemberInfo =
typeof(SomeClass).GetMembers()

but suppose I don't know the classes and also am not referencing the
assembly? I'd like to be able to find all the public members of the
assembly.

The documentation for Assembly.GetTypes() has a sample showing exactly
what you need.
 
You can load the assembly by location

Assembly assem = Assembly.LoadFrom("C:\\MyLibrary.dll");
 
Back
Top