这个问题在这里已经有了答案:Howtofindtheminimumcovarianttypeforbestfitbetweentwotypes?(3个答案)关闭9年前。这里有两种扩展方法可以使用publicstaticTypeFindInterfaceWith(thisTypetype1,Typetype2){//returnsmostsuitablecommonimplementedinterface}publicstaticTypeFindBaseClassWith(thisTypetype1,Typetype2){//returnsmostderivativeofcommonba