This prints false. why is that and how can i make it so that it prints true? my goal is to have a list of people and a temp list of people that the user can edit. at the end of the users edit i want to check if the temp list is any different from the original list, so i can check if the program should bother saving the newly edited list.
static void EqualLists()
{
List<Person> listA = new List<Person>();
List<Person> listB = new List<Person>();
Person a = new Person()
{
name = "John",
age = 18
};
Person b = new Person()
{
name = "John",
age = 18
};
listA.Add(a);
listB.Add(b);
if(listA == listB)
{
Console.WriteLine("true");
}
else
{
Console.WriteLine("false");
}
}