草庐IT

FindInterfaceWith

全部标签

c# - 如何找到两种类型中最小的可分配类型(重复)?

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