ListComparer
using System;
using System.Collections;
using System.Runtime.CompilerServices;
public static class ListComparer
{
public static bool ListsEqual(IList list1, IList list2)
{
if (list1.Count != list2.Count)
{
return false;
}
for (int i = 0; i < list1.Count; i++)
{
if (list1[i] != list2[i])
{
return false;
}
}
return true;
}
public static bool ListsEqual(IList list1, IList list2, ObjectCompareDelegate compare)
{
if (list1.Count != list2.Count)
{
return false;
}
for (int i = 0; i < list1.Count; i++)
{
if (!compare(list1[i], list2[i]))
{
return false;
}
}
return true;
}
public delegate bool ObjectCompareDelegate(object x, object y);
}