第一种,匹配俩个集合中相同的值
var listA = new List<int> { , , , , , , };
var listB = new List<int> { , , , , , , , , };
var C= listA.Intersect(listB);
foreach (var item in C)
{
Console.WriteLine(item);
}
Console.ReadLine();
第二种,拷贝
var listA = new List<int> { , , , , , , };
var listB = new List<int>(); using (MemoryStream ms = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, listA);
ms.Position = ;
listB = (List<int>)bf.Deserialize(ms);
}
参考别人的,具体是谁 我也忘记了