C
C#7mo 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
cap5lut7mo 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
VerdurOP7mo ago
Thank you, but that's not what I need unfortunately. I will ask other question in other topic
Want results from more Discord servers?
Add your server