I am trying to sort a DataTable on a string column by DateTime.
DataTable
string
DateTime
For various reasons, the column must be left as a string
List rows = new List(); foreach (DataRow row in table.Rows) { rows.Add(row); } rows.Sort((r1,r2)=>DateTime.Parse((string)r1["columnname"]).CompareTo(DateTime.Parse((string)r2["columnname"]))); var clone = table.Clone(); rows.ForEach(r => clone.Rows.Add(r.ItemArray)); return clone;