string arr1 ["11","33","2","5555","9999"]string arr2 ["11","9999"]比较这两个数组,得到第三个数组(去掉两个数组中的重复数据)的结果是arr3["33","2","5555"]那么要得到第三个数组应该怎么实现呢?
2 回答
翻过高山走不出你
TA贡献1875条经验 获得超3个赞
string[] arr1={"11","33","2","5555","9999","10"}; string[] arr2={"11","9999","1","2"}; List<string> arr=new List<string>(); foreach(string c1 in arr1) { arr.Add(c1); } foreach (string c2 in arr2) { if (!arr1.Contains(c2)) { arr.Add(c2); } } foreach(string c3 in arr) { Console.WriteLine(c3); } Console.ReadLine();
- 2 回答
- 0 关注
- 532 浏览
添加回答
举报
0/150
提交
取消