DataTableをEntityクラスのListに展開する
Protected Sub ConvertToTClass(Of T As New)()
Dim tBase As New T
_tList = New List(Of ITData)
Dim properties As PropertyDescriptorCollection =
TypeDescriptor.GetProperties(tBase.GetType)
For Each dRow In _dt.Rows
tBase = New T
For Each prop As PropertyDescriptor In properties
tBase.GetType.GetProperty(prop.Name).SetValue(tBase, If(dRow(prop.Name) IsNot DBNull.Value, dRow(prop.Name), Nothing))
Next
_tList .Add(tBase)
Next
End Sub
(*)ジェネリックメソッド
_dt:取得元のDataTableとする
_tList:展開先のListとする