Tool to show code references?

  • Thread starter Thread starter John Parrish
  • Start date Start date
J

John Parrish

Does anyone know of a tool out there that will parse a project and show
the references between classes? Its easy enough to show association
through inheritance, but how can I show dependancy, like if a class
instantiates a member of a certain type, I would like to see that type
listed as a dependancy.

Is that information possibly in the meta-data for the assembly? Thanks
 
John,

No, this isn't in the assembly. You would have to perform a
code-analysis for this. A basic way of doing this would be to get the type
of the class. Once you have that, you would check the types of the fields,
the return types of the properties (as well as the type of the parameters in
the indexer if one exists), as well as the types of the parameters and
return values of each of the methods. This should give you a decent idea of
what dependencies exist between your classes.

However, it will be harder to figure out where derived classes are used
and whatnot. For that, you will actually have to find calls to new and
Activator.CreateInstance in the IL. Additionally, you will have to find the
return values of any methods or properties you call in your methods and
properties.

Hope this helps.
 
Does anyone know of a tool out there that will parse a project and show
the references between classes? Its easy enough to show association
through inheritance, but how can I show dependancy, like if a class
instantiates a member of a certain type, I would like to see that type
listed as a dependancy.

Is that information possibly in the meta-data for the assembly? Thanks

Try 9Rays.Net Spices.Net (http://spices.9rays.net ) - this app has Modeler
plugin that shows various types of relations as between types and assemblies
diagrams - assembly references, interface implementations, inheritance and
nesting.
Diagrams can be exported as xml/uml, and as graphics.
 
Back
Top