Hey Peter, A few things:
* TypeSpecification can be nested. You can have an array of List<string>. * Types are indeed referenced by names accross assemblies. * The way this is implemented in the Mono.Linker (which does detect unused code), is by maintaining one custom assembly resolver for all the assemblies you analyze. This way, the linker makes sure that a resolved TypeDefinition is unique in the system. It makes it easier to use the definition as a map key for counting. Best regards, Jb On Fri, Oct 17, 2014 at 3:31 PM, Peter <[email protected]> wrote: > Hi > > I've been trying match up instances of TypeReference with others of > TypeDefinition and also MethodReference with MethodDefinition. > > The idea is to detect unused code/count references for each definition. > > So far I have done the matching using the FullName property. This works fine > as long as generics is not involved. > > With generic classes I have been somewhat successful: > > TypeReference dt; > if (dt is TypeSpecification) > dt = ((TypeSpecification)dt).ElementType; > var key = dt.FullName; > > But with methods it is not that trivial. Since generics in the return > argument, the method itself and in arguments can all make the FullName > property different. > I've begun to unwrap the structures and temporarily replace the generic > version with its ElementType, then get FullName of the method and finally > restore the original generic versions. > But I get the feeling that it must be a better way? > > -- > -- > -- > mono-cecil > --- > You received this message because you are subscribed to the Google Groups > "mono-cecil" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- -- -- mono-cecil --- You received this message because you are subscribed to the Google Groups "mono-cecil" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
