LINQ for Adding a Column and Conditionally Populating it with Data

Something like this will work for you
You have to amend as per your requirement
(From dr In dt.AsEnumerable Let newRecord= New Object(){dr(1),“ID”} Select dt.Rows.Add(newRecord)).CopyToDataTable

I took reference from here

1 Like