简体   繁体   中英

Accessing external Assembly Reflection

I am kind of new to Reflection and have gone through some basic examples, but I cannot figure out how to accomplish my goal.

I have a small console application which I want to call an assembly from. in this case the assembly is a Class Library Containing multiple classes and what I want to achieve is listing all of my classes with their children and parent classes.

       Assembly asm = Assembly.LoadFrom(@"C:\Sandbox\Functions\Bin\Debug\Functions.dll");

       Type T = asm.GetType();

So I have loaded the file but I am uncertain where to go now, how to use the metadata in order to access the necessary files and classes. Would appreciate some advice or references to other examples (Which I tried to search for).

Just google what specifically you are trying to do, pretty much everything you want to do with reflection is on stack overflow in some shape or form...

Assembly asm = Assembly.LoadFrom(@"C:\Sandbox\Functions\Bin\Debug\Functions.dll");

foreach (Type t in asm.GetTypes())
{
    //... t.FullName
    //... t.GetAllBaseClassesAndInterfaces
    //... t.GetNestedTypes 
}

https://stackoverflow.com/a/1315668/588734

Given a C# Type, Get its Base Classes and Implemented Interfaces

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM