The utility class Ice.CollectionComparer
allows you to compare collections for equality:
{zcode:cs} public class CollectionComparer { public static bool Equals(System.Collections.IDictionary d1, System.Collections.IDictionary d2); public static bool Equals(System.Collections.ICollection c1, System.Collections.ICollection c2); public static bool Equals(System.Collections.IEnumerable c1, System.Collections.IEnumerable c2); } {zcode} |
Equality of the elements in a collection is determined by calling the elements' Equals
method.
Two dictionaries are equal if they contain the same number of entries with identical keys and values.
Two collections that derive from ICollection
or IEnumerable
are equal if they contain the same number of entries and entries compare equal. Note that order is significant, so corresponding entries must not only be equal but must also appear in the same position.