dimanche 26 avril 2015

Measuring relational inheritance distance between types


Does anyone know how I could (or if there is an existing algorithm) measure the relational distance between two .NET types?

By this I mean the number of 'steps' in the hierarchical tree that is required to get from object A to object B.

For example, if object A is a Button, and object B is a LinkButton, there would be 2 steps, Button -> WebControl -> LinkButton. Would I need to create my own static inheritance tree and use a path finding algorithm, or is there a way I can dynamically look at the inheritance structure of .NET to calculate the distance between two objects?


Aucun commentaire:

Enregistrer un commentaire