public interface IMy<T>
{
T Implementer
{
get;
}
}
public class MyClass : IMy<MyClass>
{
...
}
But what I want is this:
public interface IMy
{
I Implementer
{
get;
}
}
Please accept that for some ca-razy reason I need an interface that defines a method that returns in the type of the implementer. No? Okay, suppose it’s something like an XML explorer, so call my interface ITree for example.
Interfaces primarily help me organize (separate), but when I have one that requires I rely on a convention, it seems to defeat the purpose.
You want to be able to say “The interface should know who implements it, and automatically provide the implementer’s type in its definition, to be inherited by the implementer”? Like
I’m pretty sure that is impossible. Such a thing may be achieved in more dynamic languages though (I’m guessing here).