在下面的代码中,我该如何将变量类型传递给嵌套的foreach语句? 是的GetControls递归函数返回一个列表控件(哇!)动态分类的foreach变量
getControls(String type, Control donde)
var tipos = new List<Type>() { typeof(Button), typeof(KryptonTextBox) };
foreach (Type t in tipos)
{
List<Control> controls = getControls(t.ToString(), this);
foreach (***** c in controls)
{
c.StateCommon.Back.Color1 = Color.White;
}
}
恩......“Button”没有“StateCommon”成员。您将无法在返回的按钮上运行该代码。 – 2009-10-23 20:54:03
@Joel你不知道Button的实际类型是什么,所以很难说明确的。 – technophile 2009-10-23 20:56:07
我稍后再尝试... – Luiscencio 2009-10-23 20:58:56