反射 泛化 问题
本人想做一个通用的加载数据到树控件中,利用反射技术.只加载了第一层,没有加载下级。
利用反射利用读到了Childs数据,类型为Object,无法转换成数组。请各位专家帮忙。
vb.net 2005开发,代码如下:
<a>http://www.jxbw.com/Example.rar</a>
部分代码如下:
Public Class teams
Inherits List(Of team)
End Class
Public Class team
Private m_ID As Integer
Private m_Name As String
Private m_Childs As teams
'添加可用属性
Public Property ID() As Integer
Get
Return m_ID
End Get
Set(ByVal value As Integer)
m_ID = value
End Set
End Property
'添加可用属性
Public Property Name() As String
Get
Return m_Name
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public ReadOnly Property Childs() As teams
Get
Return m_Childs
End Get
End Property
Public Sub New()
m_Childs = New teams
End Sub
End Class
--------------------编程问答-------------------- 中秋快乐 --------------------编程问答-------------------- ..............只有这一点点?你对反射明白吗? --------------------编程问答-------------------- 呵呵,楼上的肯定在易做图 --------------------编程问答-------------------- 接分先! --------------------编程问答--------------------
补充:.NET技术 , .NET技术前瞻