Any luck with this yet? I’m running into this more and more now, and I’m finding it increasingly harder to do it myself. Right now I have two references to System.String — one from my input assembly and one from mscorlib — and I can’t really find a way to compare them in such a way that I won’t accidentally confuse two types that only happen to have the same name. The TypeReference.Scope property refers to mscorlib version 4.0 in one case, and version 4.0.0.0 in the other, and using .Equals() on either the IMetadataScope objects or the Version objects keeps returning false. And .Resolve() also returns me separate instances of TypeDefinition, so they also compare as different. What other options do I have?
On May 18, 4:30 pm, Jb Evain <[email protected]> wrote: > On Tue, May 18, 2010 at 5:05 PM, Timwi <[email protected]> wrote: > > I'm not sure I follow your reasoning. Surely whether it's tricky or > > not is completely independent of whether it's in Rocks or directly in > > Equals? > > Not only it's tricky, but one can expect different behavior. Should a > MethodReference be Equals to another MethodReference when they are > defined in different module ? Most of the time, yes, in some other > places, I'd rather not. > > Another big issue is with generic parameters, should they be compared > by position or by identity when used as an argument. > > So for things like that, I'd rather have the code in Mono.Cecil.Rocks, > and experiment there. If at some point, everyone is happy with it, > we'll move it to Cecil. But it's nice to have Mono.Cecil.Rocks as a > playground. > > -- > Jb Evain <[email protected]> > > -- > -- > mono-cecil -- -- mono-cecil
