var query = from t in dtAll.AsEnumerable() group t by new { t1 = t.Field<string>("SourceOrderId"), t2 = t.Field<string>("SupplierDomain"), t3 = t.Field<string>("ReceiverDomain"), t4 = t.Field<string>("StorehouseId") } into m select new { SourceOrderIdEnd = m.Key.t1, SupplierDomain = m.Key.t2, ReceiverDomain = m.Key.t3, StorehouseId = m.Key.t4, rowcount = m.Count() }; query.ToList().ForEach(x => { });