It doesn't matter if I have 3 methods or 1; the point is that I need this: Type*Definition* ResolvePreserve(TypeReference)
And a GenericInstanceMethod cannot be cast to TypeDefinition, only TypeReference, but I don't need a TypeReference. I need a TypeDefinition. What I have seen so far lets me think that it is impossible (by design) for a TypeDefinition (or any Definition) to have generic arguments. Or can it be solved? 2010/7/5 Jb Evain <[email protected]> > On Mon, Jul 5, 2010 at 1:24 PM, Gábor Kozár <[email protected]> wrote: > > I need an IMemberDefinition, but there seem to be no way of having one. > What > > am I doing wrong? > > IGenericInstance and IMemberDefinition are completely different > interfaces, you can't cast a IGenericInstance to a IMemberDefinition. > The lowest common denominator here is MemberReference. > > You're trying to do to much in one method. > > You should have different cases: > > TypeReference ResolvePreserved (this TypeReference type) > MethodReference ResolvePreserved (this MethodReference method) > FieldReference ResolvePreserved (this FieldReference field) > > The first one needs to deal with type specs like in the code I pasted > here, and the second needs to deal with method specs. > > -- > Jb Evain <[email protected]> > > -- > -- > mono-cecil > -- -- mono-cecil
