Sorting Datatable Rows using LINQ

Rajesh_Kumar
Posted by Rajesh_Kumar under LINQ category on | Points: 40 | Views : 436
using System.Linq;

var new_dt = dt.AsEnumerable()
.OrderBy(r => r.Field<int>("id"))
.ThenBy(r => r.Field<DateTime>("created_date"))
.CopyToDataTable();

Here,dt is my DataTable and Id,Created_date are Datatable columns

Comments or Responses

Login to post response