I encountered a problem while using a generic interface. Initial condition was as follows:
interface Itemplate1
{
...
}
interface Itemplate2<T> where T : Itemplate1
{
...
}
It works like a charm! But when I kept going to do rest of my application design, I noticed that Itemplate1 members also need Itemplate2.
interface Itemplate1<T> where T : Itemplate2<?>
{
...
}
interface Itemplate2<T> where T: Itemplate1<?>
{
...
}
How can I do it?
Many Thanks
I’ve done exactly the same kind of thing in my Protocol Buffers port. I have to warn you that it ends up being a bit of a pain, but it does work.
In my case I needed:
and
It’s hard to say whether you’ll need exactly the same pattern in your code or just something similar, but this has worked for me. Admittedly it helps that the actual concrete implementations are autogenerated…