Is there a way to get all of the properties for a TypeDefinition, base
class(es) included (i.e. all the way up to the root)? I looked at
DeclaringType but that gives me a TypeReference which doesn't have
Properties on it.
The issue here is that Cecil's type system is quite different from the
System.Reflection one. Because in System.Reflection all referenced
assemblies have to be loaded, there's no distinction between a
reference and a definition.
Cecil does this distinction. So it could be that the .BaseType of a
TypeDefinition is a TypeReference, which of course, doesn't have any
information but its name and scope.
What we do usually is use something to Resolve a TypeReference into a
TypeDefinition, to better analyze it.
Such a resolver will make it into the next version of Cecil, but for
the time being, people are usually using the one I wrote for the
linker, which is available here:
So by walking down the inheritance chain, and resolving the
references, you'll be able to collect all inherited properties.
--
Jb Evain <j...@nurv.fr>