I have two class :
public class Customer
{
public string FirstName { get; set; }
public string LastName { get; set; }
public bool isActif { get; set; }
public Product[] Product { get; set; }
}
public class Product
{
public string Id { get; set; }
}
And two instances :
var Customer1 = new Customer[]
{
new Customer()
{
FirstName = "FirstName1",
LastName = "LastName1",
isActif = true,
Product = new Product[]
{
new Product()
{
Id = "2",
Date = DateTime.Now.Date
}
}
},
new Customer()
{
FirstName = "FirstName2",
LastName = "LastName2",
isActif = false,
Product = new Product[]
{
new Product()
{
Id = "3",
Date = DateTime.Now.Date
}
}
}
};
var Customer2 = new Customer[]
{
new Customer()
{
FirstName = "FirstName1",
LastName = "LastName1",
isActif = true,
Product = new Product[]
{
new Product()
{
Id = "2",
Date = DateTime.Now.Date
}
}
}
};
I want to get the intersect of the two instances by contribution in the LastName
. Is it possible to do this without implementing the method Equals() and GetHashCode() in my class ? I have a lot of properties.
Also, I would like to know the customers present in the first authority and not in the second. And conversely