I'm using this code for checking if two List<T>
are equal or not:
public static bool EqualsAll<T>(this IList<T> a, IList<T> b)
{
if (a == null || b == null)
return (a == null && b == null);
if (a.Count != b.Count)
return false;
EqualityComparer<T> comparer = EqualityComparer<T>.Default;
for (int i = 0; i < a.Count; i++)
{
if (!comparer.Equals(a[i], b[i]))
return false;
}
return true;
}
Now assume that I'm using this code for checking two big lists. Is this code efficient?