|
@@ -2734,6 +2734,32 @@ namespace InABox.Core
|
|
|
list.Sort((a, b) => comparison(a).CompareTo(comparison(b)));
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Compare the elements in this list to the other list, returning <see langword="true"/> if they have all the same
|
|
|
+ /// elements, regardless of order.
|
|
|
+ /// </summary>
|
|
|
+ public static bool CompareTo<T>(this IList<T> thisList, IList<T> list)
|
|
|
+ {
|
|
|
+ if(thisList.Count != list.Count)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return thisList.All(x => list.Contains(x));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Compare the elements in this list to the other list, returning <see langword="true"/> if they have all the same
|
|
|
+ /// elements, regardless of order.
|
|
|
+ /// </summary>
|
|
|
+ public static bool CompareTo<T>(this IList<T> thisList, IList<T> list, IEqualityComparer<T> comparer)
|
|
|
+ {
|
|
|
+ if(thisList.Count != list.Count)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return thisList.All(x => list.Contains(x, comparer));
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
}
|