MSDN 을 찾아보면 두개의 TXT 파일에 문자열이 다른 부분을 찾는 설명이 존재합니다.
자세히 내용을 살펴보면...
static void Main()
{
// Create the IEnumerable data sources.
string[] names1 = System.IO.File.ReadAllLines(@"../../../names1.txt");
string[] names2 = System.IO.File.ReadAllLines(@"../../../names2.txt");
// Create the query. Note that method syntax must be used here.
IEnumerable<string> differenceQuery =
names1.Except(names2);
// Execute the query.
Console.WriteLine("The following lines are in names1.txt but not names2.txt");
foreach (string s in differenceQuery)
Console.WriteLine(s);
// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
static void Main(string[] args)
{
List<string> names = new List<string>
{ "심재운", "이유진", "권판진", "이현수", "양경욱" };
Dictionary<string, string> visiting = new Dictionary<string, string>()
{ { "심재운", "Turkey" }, { "이유진", "Germany" }, { "권판진", "Bangalore" } };
var minus =
from n in names
let places = from p in visiting select p.Key
where !places.Contains(n)
select n;
foreach (var v in minus)
Console.WriteLine(v);
Console.ReadKey();
}