I want to call a generic method that constrains the input type T to implement two interfaces:
interface IA { }
interface IB { }
void foo<T>(T t) where T : IA, IB { }
How can I fix the last line of
void bar(object obj)
{
if (obj is IA && obj is IB)
{
foo((IA && IB)obj);
}
}
?
Reflection probably allows to do the call, but I would like to stay within the language.