Posts

Showing posts with the label Convert LinQ to Datable in C#

Convert LinQ to Datable in C#

Var List= From Tolist(); DataTable table = LINQToDataTable(List);//You will get DataTable Value public DataTable LINQToDataTable<T>(IEnumerable<T> varlist)     {        DataTable dtReturn = new DataTable();        dtReturn.Clear();         // column names         PropertyInfo[] oProps = null;         if (varlist == null) return dtReturn;         foreach (T rec in varlist)         {             if (oProps == null)             {                 oProps = ((Type)rec.GetType()).GetProperties();        ...