If you want the elements MyListto belong to the class of the implementing type, you need to use generics. You should also use restraint to make you Tbe the type that implements the interface. And MyListstill should be IListin the implementation class.
IMyInterface<T> where T : IMyInterface<T>
{
IList<T> MyList { get; set; }
int X { get; set; }
int Y { get; set; }
}
public class MyClass: IMyInterface<MyClass>
{
public int X { get; set; }
public int Y { get; set; }
public IList<MyClass> MyList { get; set; }
}
This does not stop someone from doing something like
public class AnotherClass: IMyInterface<MyClass>
{
public int X { get; set; }
public int Y { get; set; }
public IList<MyClass> MyList { get; set; }
}
.