本文介绍了propertyinfo.getvalue" Object与目标类型不匹配“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用PropertyInfo中的GetValue但继续获取对象与目标类型不匹配。我尝试过使用一个字符串变量,它说我没有在其他帮助中看到我的识别。



  For  每个 logentry  As  LogEntry  _lr 
对于 每个 _pi logentry。 GetType .GetProperties()

Dim _val = _pi.GetValue(_pi。 GetType (), Nothing
控制台。 WriteLine( String .Format( {0}:{ 1},_ pi.Name,_val))
下一步
下一步
解决方案

I'm trying to use GetValue from PropertyInfo but keep getting "Object Does Not match target type". I have tried using a string variable and it says Me is not recongized which I saw in other help.

For Each logentry As LogEntry In _lr
            For Each _pi In logentry.GetType.GetProperties()

                Dim _val = _pi.GetValue(_pi.GetType(), Nothing)
                Console.WriteLine(String.Format("{0}:  {1}", _pi.Name, _val))
            Next
        Next
解决方案


这篇关于propertyinfo.getvalue" Object与目标类型不匹配“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 20:38