04-03-20 12:06 PM
Answered! Go to Answer.
02-07-20 11:25 AM
02-07-20 01:48 PM
03-07-20 07:42 AM
ErrorMessage = ""; CollectionOut = new DataTable(); DataTable dt1 = new DataTable(); try { dt1 = CollectionIn; DataTable dtMerged = dt1.AsEnumerable() .GroupBy(r => new {d= r.Field<string>("put here column name from your collection") }) .Select(g => g.First()).CopyToDataTable(); CollectionOut = dtMerged; } catch (Exception ex) { ErrorMessage = ex.Message.ToString(); }
Namespace Imports:
System.Linq
System.Reflection
System.Collections.Generic
External References:
System.Linq.dll
System.Data.Common.dll
System.Core.dll
System.Data.DataSetExtensions.dll
Hope this will help:)