using System;
using System.Collections.Generic;
using System.Linq;
public class Test
{
public class Details
{
public int id;
public string symbol;
public string code;
public override string ToString() {
return string.Format("{0} {1} {2}", id, symbol, code);
}
}
public static void Main()
{
List<Details> list1 = new List<Details>();
List<Details> list2 = new List<Details>();
list1.Add(new Details() { id=1,symbol="ANSI",code="NITE"});
list1.Add(new Details() { id = 1, symbol = "ANSI", code = "CALGO" });
list1.Add(new Details() { id = 1, symbol = "ANSI", code = "CANT" });
list1.Add(new Details() { id=2,symbol="ANSI",code="NITE"});
list1.Add(new Details() { id = 2, symbol = "ANSI", code = "CALGO" });
list1.Add(new Details() { id = 2, symbol = "ANSI", code = "CANT" });
list2.Add(new Details() { id = 1, symbol = "ANSI", code = "NITE" });
list2.Add(new Details() { id = 1, symbol = "ANSI", code = "CALGO" });
list2.Add(new Details() { id = 2, symbol = "ANSI", code = "NITE" });
foreach (var v in
list1.Where(x=>
list2.Any(z=>x.id==z.id && x.symbol==z.symbol)
&& !list2.Any(z => x.id==z.id && x.symbol==z.symbol && x.code==z.code))
) {
Console.WriteLine(v);
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkxpbnE7CgpwdWJsaWMgY2xhc3MgVGVzdAp7CgkKCXB1YmxpYyBjbGFzcyBEZXRhaWxzCnsKICAgIHB1YmxpYyAgIGludCBpZDsKICAgIHB1YmxpYyBzdHJpbmcgc3ltYm9sOwogICAgcHVibGljIHN0cmluZyBjb2RlOwogICAgcHVibGljIG92ZXJyaWRlIHN0cmluZyBUb1N0cmluZygpIHsKICAgIAlyZXR1cm4gc3RyaW5nLkZvcm1hdCgiezB9IHsxfSB7Mn0iLCBpZCwgc3ltYm9sLCBjb2RlKTsKICAgIH0KfQoJCglwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCgl7Ckxpc3Q8RGV0YWlscz4gbGlzdDEgPSBuZXcgTGlzdDxEZXRhaWxzPigp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