I am using two lists. Both of them have exactly the same properties and namings. Is it possible to check the both lists are equal or not?
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
public Person(string name, int age)
{
this.Name = name;
this.Age = age;
}
}
var list1 = new List<Person>();
list1.Add(new Person("Dim", 12));
list1.Add(new Person("Dio", 13));
var list2 = new List<Person>();
list2.Add(new Person("Dim", 12));
list2.Add(new Person("Dio", 13));
bool listsEqual = list1 == list2;
Debug.WriteLine("Lists are equal: " + listsEqual);