List<BatchOrders> batchOrders = new List<BatchOrders>();
batchOrders = result.Item3;
DataTable dt = new DataTable();
if (batchOrders.Count > 0)
{
PropertyInfo[] propertys = batchOrders[0].GetType().GetProperties();
foreach (PropertyInfo pi in propertys)
{
dt.Columns.Add(pi.Name);
}
foreach (object t in batchOrders)
{
ArrayList tempList = new ArrayList();
foreach (PropertyInfo pi in propertys)
{
object obj = pi.GetValue(t, null);
tempList.Add(obj);
}
object[] array = tempList.ToArray();
dt.LoadDataRow(array, true);
}
}