I am working on a solution that extracts all the class associations between each other. If we click a class in the object browser we can see the option Find All References. I want something similar that finds the associations a class has to other classes. How can we find them using Reflection?
I am interested in Extracting
- Composition Relationship:
- Aggregation Relationship
- Association Relationship
- Inheritance
You can use
Reflectionin order to list all properties, fields and methods (and more) of a class. You would have to inspect these and determine their types and parameter lists. Probably it would be a good idea to discard types from theSystemnamespace.Intellisense will tell you (almost) all the secrets of
FieldInfo,PropertyInfo,MethodInfoandParameterInfo. You might also consider examining the generic parameters of the class, events and more.