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 :
Customer Customer1 = new Customer
{
FirstName = "FirstName1",
LastName = "LastName1",
isActif = true,
Product = new Product[]
{
new Product()
{
Id = "1"
}
}
};
Customer Customer2 = new Customer
{
FirstName = "FirstName2",
LastName = "LastName2",
isActif = false,
Product = new Product[]
{
new Product()
{
Id = "2"
}
}
};
I have one method who compare all properties of the two instances :
But when I get to the property Product, I have an StackOverflowException generated. Why ? And how to loop the property if it's a array ?
EDIT : When I use the List there is not StackOverflowException but System.Reflection.TargetParameterCountException. How to loop the property if it's a array