I have the following problem: I need to find the root method of interface 
implementations for any of my own methods. The MetadataResolver.GetMethod 
method does that pretty well. I found it in 
MethodDefinitionRocks.GetBaseMethod which only handles base classes, not 
interfaces. But it fails in the following situation:

class MyClass : IEquatable<MyClass>
{
    public bool Equals(MyClass other) { ... }
}

Let methodDef be the MethodDefinition of the "Equals" method and iface be 
the implemented interface from methodDef.DeclaringType.Interfaces.

MetadataResolver.GetMethod(iface.Methods, methodDef) returns null. From 
debugging into it, I know that it breaks when comparing both parameters' 
"etype" field with is "Var" for the generic type parameter "T" from 
IEquatable<T> and "None" for MyClass.

While I understand that T is not MyClass, T is a variable that may well 
become MyClass. What should I do to find the root method in a generic 
interface? Is there a better alternative somewhere?

-- 
-- 
--
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.

Reply via email to