2015-11-06 34 views
0

Intellisense调用VB.net

使用“调用”通过反射的方法时,你可以在图片中看到我从调用的返回值看如何阅读返回复杂的对象值,但我不能使用它们。
如何将返回对象转换为其他东西。这个函数是动态的,所以我不能使用这个类的引用对象。

+0

集'选项严格Off'阅读对象并调用'矿石(0).CustomerName'或什么的。 – GSerg

+0

感谢您的回复... –

+0

问题是,根据我调用的方法,返回的对象可能会有所不同,我不知道成员名称是什么。我需要以某种方式将这些值读入数组或集合,以便我可以通过索引访问它们。有没有办法做到这一点? –

回答

0

谢谢! 我设法利用这个

Dim oResults As Object = oMethod.Invoke(oUbCustomerService, oParameterValues) For Each oResult in oResults Dim oFieldInfoList() As FieldInfo = oResult.GetType().GetFields dim strValue as String = oFieldInfoList(n).GetValue(oResult) ... Next