Here is if my DataTable
DataTable dt = new DataTable();
dt.Rows.Add(2,Test1,Sample1);
dt.Rows.Add(2,Test2,Sample2);
dt.Rows.Add(4,Test3,Sample3);
dt.Rows.Add(4,Test4,Sample4);
dt.Rows.Add(2,Test5,Sample5);
I want to display message Duplicate record exist for class 4
it is possbile by using two loops by comparing, but i want an optimized code that will return me the duplicate record and i will display a message. The code may be using Linq if any body know please share..?
Assuming that you get a duplicate record when the value of the first column is identical for two or more rows:
Here is an example: