我正在使用System.Reflection加载一个我在设计时无法加载的类型。我需要将这个类型的集合中的所有控件都拉出来,但是,OfType命令似乎不喜欢反射语法。这里是“接近”我得到的。.Net使用反射来定义OfType
Dim ControlType As Type = System.Reflection.Assembly.GetAssembly(_
GetType(MyAssembly.MyControl)) _
.GetType("MyAssembly.MyUnexposedControl")
Dim Matches as List(Of Control) = MyBaseControl.Controls.OfType(Of ControlType)
因此,代码是假的,它不起作用,但你知道我正在尝试做什么。那么有没有一种方法可以使用反射并获得所有这种类型的控件?
这个好,但是,“去哪儿”,似乎看不出现在System.Web.UI.ControlCollection – 2009-05-27 22:17:17