vb.net反射中如何将字符串转化为对象实例

前端之家收集整理的这篇文章主要介绍了vb.net反射中如何将字符串转化为对象实例前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Imports System.Reflection

Public Class Form1

Private Sub Button1_Click( ByVal sender As System.Object,255)">ByVal e As System.EventArgs) Handles Button1.Click
Dim o As Object = Activator.CreateInstance(Type.GetType( " A.a ")) ' 工程名称.类名
Dim MyProperty As PropertyInfo = o.GetType().GetProperty( NAME ")
Dim objValue Object = " Bbb "
MyProperty.SetValue(o,objValue,255)">Nothing)
Dim objReturn() Object
MsgBox(MyProperty.GetValue(o,objReturn).ToString())
End Sub
End Class

Class a
private _name String
Public _id Integer

Property NAME() As String
Get
Return _name
End Get

Set( ByVal value String)
_name = value
Set
End Property

End Class 原文链接:/vb/258687.html

猜你在找的VB相关文章