我需要使用从一个类继承的不同子类中嵌入的几个函数。例如,来自ListViewA
的{{1}}和ListViewB
。子类来自第三方软件和开源。有没有一种简单的方法来组合所有功能?
答案 0 :(得分:0)
您可以尝试这样的事情:
foreach(ListView unknownListView in unknownObjectList)
{
if (unknownListView is ListViewA )
{
var LWA = unknownListView as ListViewA;
// ... do something with ListViewA
}
if (unknownListView is ListViewB )
{
var LWB = unknownListView as ListViewB ;
// ... do something with ListViewB
}
}