using System.Data; using System.Linq; public class Demo { public static DataTable Method(DataTable dt1, DataTable dt2) { var normalReceive = from r2 in dt2.AsEnumerable() where (from r1 in dt1.AsEnumerable() select r1.Field<string>("taskmch") ).Contains(r2.Field<string>("taskmch")) select r2; DataTable dt3 = normalReceive.CopyToDataTable(); return dt3; } }
从网易博客(http://cxwstar.blog.163.com/blog/static/484687632015814372171/)迁移,原发表于2015年9月1日.