how to convert DataTable to List<> dynamically

Nov 22 2014 1:56 AM
Can Anyone suggest me how to convert DataTable to List<> dynamically ?

I need a function where if I pass class name or object of class with dataTable that function should return List<Object_Of_Class_Pass_In_Function>.

Ex :

Public List<xy> ChnageDtToList(DataTable dt, <Here Dynamic Object Of Any Custom Class say xy>)

{

//

Return List<xy>

}

How to create above function ?


Answers (3)