using System.Linq;
using System.Xml.Linq;
public class Example
{
public static void Main()
{
Console.Write("<< ExceptBy 예제 >> \n");
List<Car> cars = new List<Car>();
cars.Add(new Car() { CarCode = 1, CarType = 101 });
cars.Add(new Car() { CarCode = 1, CarType = 101 });
cars.Add(new Car() { CarCode = 2, CarType = 101 });
cars.Add(new Car() { CarCode = 3, CarType = 102 });
cars.Add(new Car() { CarCode = 3, CarType = 102 });
List<Car> cars2 = new List<Car>();
cars2.Add(new Car() { CarCode = 1, CarType = 101 });
cars2.Add(new Car() { CarCode = 1, CarType = 101 });
var except = cars2.ExceptBy(cars, x => x);
foreach (var item in except)
{
Console.WriteLine(item.CarCode);
}
Console.WriteLine(System.Environment.NewLine);
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
public class Car
{
public int CarCode { get; set; }
public int CarType { get; set; }
}