CSharp examples for System.Data:DataTable
Create Data Table
using System.Reflection; using System.Collections; using System.ComponentModel; using System.Data; using System.Text; using System.Linq; using System.Collections.Generic; using System;//from w w w . j a v a 2 s .c o m public class Main{ private static DataTable CreateDataTable<T>(string tableName, IEnumerable<T> collection, PropertyInfo[] properties) { DataTable dt = new DataTable(tableName); foreach (PropertyInfo property in properties) { dt.Columns.Add(property.Name.ToString()); } return dt; } }