snippet: view plain - save this
1 public static bool compare<T>(ICollection<T> tabA, ICollection<T> tabB) where T : IComparable
2 {
3 System.Diagnostics.Debug.Assert(tabA != null);
4 System.Diagnostics.Debug.Assert(tabB != null);
5
6 if ( tabA.Count != tabB.Count)
7 return false;
8
9 IEnumerator<T> enumA = tabA.GetEnumerator();
10 IEnumerator<T> enumB = tabB.GetEnumerator();
11 while ( enumA.MoveNext() && enumB.MoveNext() )
12 {
13 if ( enumA.Current.CompareTo(enumB.Current) != 0 )
14 return false;
15 }
16 return true;
17 }

0 comments