要获得在Server 2003上运行的.NET控制台应用程序,我们必须将我们的一个核心库从.NET 4.5降级到4.0 。除此之外,这个库有一个执行一些反射的类,通过对象的属性循环来获取它们的值。使用Propertyinfo.GetValue()
System.Reflection.PropertyInfo.GetValue() - 降级.NET版本 - 缺少方法签名
根据the MSDN documentation,PropertyInfo.GetValue (Object)
仅在.NET 4.5中。在.NET 4.0中,this method存在,但是格式为PropertyInfo.GetValue (Object, Object[])
(额外的参数是知道如何处理索引属性)。
如果我们要降级此代码,我们需要知道PropertyInfo.GetValue Method (Object)
遇到索引属性时会发生什么情况,因此我们可以使用PropertyInfo.GetValue Method (Object, Object[])
来镜像此功能。谁能帮忙?
很好的答案,谢谢:) – user3181548