C
C#2mo ago
Verdur

Interface implementing generic parameters

Hello, is there way to achieve something like this?
interface IFoo<T> : T { }
interface IFoo<T> : T { }
I want to specify that IFoo<T> should also implement T
2 Replies
cap5lut
cap5lut2mo ago
afaik thats not possible, the best u can do is at the implementin type specify itself, but thats it
class Foo : IFoo<Foo> { }
class Foo : IFoo<Foo> { }
especially because interfaces can only extend other interfaces, and u cant constrain T to be an interface (interface as in the general thingy not a specifc interface)
Verdur
Verdur2mo ago
Thank you, but that's not what I need unfortunately. I will ask other question in other topic