Thanks for a quick response, Jb.
I just tried but it seems that the scopes are not equal either.
I.e.:

Equals(typeDef.Scope, typeDef.Module.Import(type).Resolve().Scope)

.. returns false

I can compare its name, but would it be 100% fool-proof? I.e. can I possibly
have 2 scopes (modules) with the same name, containing types with the same
full name (e.g. different versions of the same assembly).
Cheers

On Tue, Jul 12, 2011 at 10:30 PM, Jb Evain <[email protected]> wrote:

> Hi,
>
> On Tue, Jul 12, 2011 at 2:19 PM, Hendry Luk <[email protected]> wrote:
> > I'm actually trying to compare the equality between a TypeDefinition and
> > System.Reflection.Type. The following does not work:
> >
> > Equals(typeDef, typeDef.Module.Resolve(type))
> >
> > It returns true in some cases, but occasionally it returns false (even
> > though they're the same type).
>
> It works if you make sure that you're loading assemblies once. This
> means that you have to pass the same resolver to each assembly.
>
> > Is there any proper way to achieve this?
>
> Another is to compare by scope + fullname.
>
> Jb
>
> --
> --
> mono-cecil

-- 
--
mono-cecil

Reply via email to