两个字段比较是否有重复数据

var dt = new DataTable();

var hash = new HashSet<String>();
foreach (DataRow row in dataTable.Rows)
{
var key = String.Concat(row["code"], row["name"]);
if (hash.Add(key))
{
//不重复
}
else
{
//重复
}
}

原文地址:https://www.cnblogs.com/yoyo-524/p/6807558.html