Public Function GetDataTable(ByVal MyObjectList As Object, ByVal objectProperties As Object) As DataTable
Dim MyTable As New DataTable
'create a column for each property in the class
For Each propertyItem As PropertyInfo In objectProperties
MyTable.Columns.Add(
New DataColumn(propertyItem.Name))
Next
For Each oObject As Object In MyObjectList
Dim row As DataRow = MyTable.NewRow()
For Each propertyItem As PropertyInfo In objectProperties
row(propertyItem.Name) = propertyItem.GetValue(oObject,
Nothing)
Next
MyTable.Rows.Add(row)
Next
GetDataTable = MyTable
End Function
I tried this one for converting GenericList to DataTable Iam passing PropertiesInfo also as a parameter but I want to pass only GenericLsit single parameter.
and Iam not geting for converting DataTable to GenricList please help me.