Hi,
suppose I have a generic interface declaration like this...
public interface MyInterface<T>
{
T InterfaceMethod();
}
Now, I can easily retrieve a TypeReference that refers to
MyInterface<T>, and I can retrieve from that a MethodReference that
refers to MyInterface<T>.InterfaceMethod().
Suppose I also have a TypeReference that refers to the instance type
MyInterface<string>. How do I get a MethodReference object that refers
to MyInterface<string>.InterfaceMethod()?
I've tried using the MethodReference constructor, but no matter what I
pass to it, the final assembly always ends up having an invalid method
reference in it (according to both Reflector and the .NET runtime).
What I'm really trying to do is to turn an implicit interface
implementation like this:
public class MyClass : MyInterface<string>
{
public string InterfaceMethod()
{
return "MyClass.InterfaceMethod()";
}
}
into an explicit one, which in C# would look like this:
public class MyClass : MyInterface<string>
{
string MyInterface<string>.InterfaceMethod()
{
return "MyClass.InterfaceMethod()";
}
}
To do this, I need to add (to the class method's Overrides) the
MethodReference pointing to MyInterface<string>.InterfaceMethod(). How
do I get it?
--
--
mono-cecil
To unsubscribe from this group, send email to
mono-cecil+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.