我需要使用从一个类继承的不同子类中嵌入的几个函数。例如ListViewA
,ListViewB
从ListView
. 子类来自第三方软件和开源。有没有一种简单的方法来组合所有功能?
问问题
175 次
1 回答
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
}
}
于 2013-01-10T13:37:01.097 回答