How to map datatable columns to properties of DTO object of Type T
问题 How can map datatable columns with the properties of DTO object of Type T using LINQ query or Lambda expression. This should automatically map with any DTO. If there is a way to do this without hardcoding of column names of datatable DataTable dt = db.GetEmployees(); foreach(DataRow dr in dt.Rows) { var obj = new T(); PropertyInfo[] prop = obj.GetType().GetProperties(); var results = dt.AsEnumerable().Select(dr => new T { ///How to directly map type T properties in prop with columns in