Delete Rows from DataTable Using Linq in C#

Delete Rows from DataTable Using Linq in C#

Delete Rows from DataTable Using Linq in C# :-

IEnumerable<DataRow> rows = DataTableObject.Rows.Cast<DataRow>().Where(r => r[“EmployeeId”].ToString() == “0123”
&& r[“EmployeeName”].ToString() == “Abdul”);

rows.ToList().ForEach(r => r.Delete());
dt.AcceptChanges();

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply