The following code is just made up, is this possible to do with C#?
class A
{
public int DoStuff()
{
return 0;
}
}
class B
{
public string DoStuff()
{
return "";
}
}
class MyMagicGenericContainer<T> where T : A, B
{
//Below is the magic <------------------------------------------------
automaticlyDetectedReturnTypeOfEitherAOrB GetStuff(T theObject)
{
return theObject.DoStuff();
}
}