0
我想要获得所有以“Foo”开头的ObjectSet。我已经编写了下面的代码,但它并没有进入if结构。比较泛型类型的运行时类型
foreach (PropertyDescriptor prop in TypeDescriptor.GetProperties(context))
{
if (prop.PropertyType == typeof(ObjectSet<>))
{
// It doesn't step here even though
// prop.PropertyType is an ObjectSet`1...
请帮忙。
非常感谢。 –
我会怎么说:'prop.GetValue(context)as ObjectSet <>'? –
@ WaterCoolerv2:恐怕你不会。之后你想用它做什么?你可以将它转换为ObjectQuery,或者使用反射或动态输入来调用方法。 –