【问题标题】:c# reflection on ObservableCollectionc# ObservableCollection 上的反射
【发布时间】:2016-06-14 20:13:56
【问题描述】:

我们正在反射一个 .net dll,它是一个 silverlight dll:

Type:System.Collections.ObjectModel.ObservableCollection`1[product.entity.Customer]

如何处理'1?

observable 集合声明如下:

ObservableCollection<product.entity.Customer> list = new ObservableCollection<product.entity.Customer>();

product.entity.Customer 只是一个 POCO。

我的问题不是关于 POCO,而是关于 '1 的反映。

如何确定何时/如何反映可观察集合持有的对象?

...
existingTypes = loadedAssembly.GetTypes();
...
flags_plus = BindingFlags.DeclaredOnly | BindingFlags.Public |    BindingFlags.Instance | BindingFlags.Static;

propertyInfo = type.GetProperties(flags_plus);
...
propertyInfo.PropertyType had the '1 in it...

【问题讨论】:

    标签: c# silverlight reflection observablecollection


    【解决方案1】:

    调用GetGenericTypeArguments()查看作为类型参数传递的类型列表。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多