How to obtain referenced types via Reflection?

DanielM

Newcomer
Joined
Jul 20, 2004
Messages
7
Does anybody know a way how to programatically obtain all referenced types of a Type object? I mean a similar funtion to Lutz Roeder's .NET Reflector's Analyzer -> Depends on... function but I need to utilize it from C# code.

Is an API for Lutz Roeder's .NET Reflector available? It must be since there are many Add-Ins available for it, but I can't find it...

Thanks in advance.

Daniel
 
Try opening reflector with reflector. I don't know what is inside, but I know it runs on the .Net framework, so it is possible that Reflector.exe is the API.

As far as determining what classes another class depends on (without using third party libraries), all that should be involved is looping through all the members of a class and determining what types each field/property/return/parameter is.
 
marble_eater said:
Try opening reflector with reflector. I don't know what is inside, but I know it runs on the .Net framework, so it is possible that Reflector.exe is the API.

I had the same idea, but Reflector's code seems to be obfuscated... :D
It is possible to see its dependencies - just .NET stuff, nothing else.

marble_eater said:
As far as determining what classes another class depends on (without using third party libraries), all that should be involved is looping through all the members of a class and determining what types each field/property/return/parameter is.

IMO examining the method/property signatures and the member types is not enough. What's about the types that are referenced by the implementation (property or method bodies) of the class?

It seems to me like Reflector is interpreting the MSIL byte code :o But there must be an API since there are so many AddIns for it...
 
DanielM said:
I had the same idea, but Reflector's code seems to be obfuscated...
Reflector isn't open source? I guess I never realized that until just now. I wonder why it is not.

With regards to add-ins, it might be worth checking out the add-ins workspace to see if there is some more info there.
 
I had the same idea, but Reflector's code seems to be obfuscated...
You really ought to double check that. I noticed that many classes were obfuscated, but I also noticed dozens upon dozens of public classes and interfaces (specifically, in the CodeModel and CodeModel.Memory namespaces) where the only obfuscated members were private fields.
 
Back
Top