Hi,
In C# it's possible to defined a method parameter with two interface restrictions. This with bounds. For example.
interface IA
{
int A {get;}
}
interface IB
{
int B {get;}
}
void Foo<T>(T param1) where T: IA, IB {}
So two interfaces, and the first parameter (param1
) of the method Foo
should implement both interfaces.
But is this really useful? AFAIK it's not possible to cast an object to multiple interfaces in C#? Of course a class can implement two interfaces.