110,536
社区成员
发帖
与我相关
我的任务
分享
string[] phoneNumbers1 = File.ReadAllLines(@"c:\phoneNumber1.txt");
string[] phoneNumbers2 = File.ReadAllLines(@"c:\phoneNumber2.txt");
string[] result1 = phoneNumbers1.Except(phoneNumbers2).ToArray();
string[] result2 = phoneNumbers2.Except(phoneNumbers1).ToArray();
File.WriteAllText(@"c:\phoneNumber1.txt", string.Join("\r\n", result1));
File.WriteAllText(@"c:\phoneNumber2.txt", string.Join("\r\n", result2));
string[] phoneNumbers1 = File.ReadAllLines(@"c:\phoneNumber1.txt");
string[] phoneNumbers2 = File.ReadAllLines(@"c:\phoneNumber2.txt");
string[] result1 = phoneNumbers1.Except(phoneNumbers2).ToArray();
string[] result2 = phoneNumbers2.Except(phoneNumbers1).ToArray();
File.WriteAllText(@"c:\phoneNumber1.txt", string.Concat(result1));
File.WriteAllText(@"c:\phoneNumber2.txt", string.Concat(result2));