Skip to content

Collections

Evgeny Vashchenko edited this page Jan 23, 2023 · 1 revision

Collections

Equality and comparison

There are a lot of classes that implement the equality and comparison interfaces and extension methods for working with them. Added two delegates Equality<T> and Comparator<T> and interface IComparator<T>. The Equality<T> delegate is a delegate for equality comparison methods such as Equals of the IEqualityComparer<T> interface. The Comparator<T> delegate is a delegate for single-parameter comparison methods, such as the Compare method of the IComparator<T> interface. This interface is used, for example, in search methods on sorted data. In the search method, instead of a pattern for searching and an comparer interface with two parameters, a method with one parameter is passed, which will be called by the search function with a list element. The pattern comparison logic will be in the comparator.

public delegate bool Equality<in T>(T x, T y);

public delegate int Comparator<in T>(T v);

public interface IComparator<in T>
{
  int Compare(T? obj);
}

There are extension methods and classes where, in conjunction with the IEqualityComparer<T> interface or the Equality<T> delegate, an additional boolean nullVarious parameter is used for nullable values. This parameter affects the comparison of null values and when set, two null values are considered unequal. Also found in conjunction with the IComparer<T> interface or the Comparison<T> delegate for nullable values is an additional nullOrder parameter of type RelativeOrder. This parameter indicates the order of null values. When set to RelativeOrder.Lower, null values always precede any other values. With RelativeOrder.Upper , null values are always behind any other values.

Also, added several enum types with criteria for matching the condition:

  • ComparisonCriteria - criteria for comparing values.

    public enum ComparisonCriteria
    {
      Equal,
      NotEqual,
      LessThan,
      GreaterThan,
      LessThanOrEqual,
      GreaterThanOrEqual,
    }
  • BetweenCriteria - criteria for entering a value in the interval.

    public enum BetweenCriteria
    {
      IncludeBoth,
      ExcludeLower,
      ExcludeUpper,
      ExcludeBoth
    }
  • GroupCriteria - criteria for grouping conditions.

    public enum GroupCriteria
    {
      And,
      Or
    }
  • QuantifyCriteria - criteria for the set of elements that satisfy the condition.

    public enum QuantifyCriteria
    {
      Any,
      All
    }

List extensions

The ListExtension class contains a lot of extension methods for working with objects that implement the IList interface. For the non-generic IList interface, the methods of the PowerLib.System.Collections.NonGeneric.Extensions.ListExtension class are used. For the generic IList<T> interface, methods of the PowerLib.System.Collections.Generic.Extensions.ListExtension class are used. Extension methods are divided into several sections:

  • Getting methods

    The methods in this section return an item or a range of items from a list.

    Methods
    public static TSource GetAt<TSource>(this IList<TSource> list, int index);
    
    public static TSource GetBound<TSource>(this IList<TSource> list, Bound bound);
    
    public static TSource GetFirst<TSource>(this IList<TSource> list);
    
    public static TSource GetLast<TSource>(this IList<TSource> list);
    
    public static bool TryGetBound<TSource>(this IList<TSource> list, Bound bound, out TSource? result);
    
    public static bool TryGetFirst<TSource>(this IList<TSource> list, out TSource? result);
    
    public static bool TryGetLast<TSource>(this IList<TSource> list, out TSource? result);
    
    public static IReadOnlyList<TSource> GetRange<TSource>(this IList<TSource> list, int index, int count);
    
    public static IReadOnlyList<TSource> GetRange<TSource>(this IList<TSource> list, (int index, int count) range);
  • Setting methods

    The methods in this section set an item or a range of items in a list.

    Methods
    public static void SetAt<TSource>(this IList<TSource> list, int index, TSource item);
    
    public static void SetBound<TSource>(this IList<TSource> list, Bound bound, TSource item);
    
    public static void SetFirst<TSource>(this IList<TSource> list, TSource item);
    
    public static void SetLast<TSource>(this IList<TSource> list, TSource item);
    
    public static bool TrySetBound<TSource>(this IList<TSource> list, Bound bound, TSource item);
    
    public static bool TryGetFirst<TSource>(this IList<TSource> list, TSource item);
    
    public static bool TrySetLast<TSource>(this IList<TSource> list, TSource item);
    
    public static void SetRepeat<TSource>(this IList<TSource> list, int index, TSource value, int count);
    
    public static void SetRange<TSource>(this IList<TSource> list, int index, IEnumerable<TSource> items);
    
    public static void SetRange<TSource>(this IList<TSource> list, int index, int count, IEnumerable<TSource> items);
  • Adding methods

    The methods in this section add an item or a range of items to a list.

    Methods
    public static void AddBound<TSource>(this IList<TSource> list, Bound bound, TSource item);
    
    public static void AddFirst<TSource>(this IList<TSource> list, TSource item);
    
    public static void AddLast<TSource>(this IList<TSource> list, TSource item);
    
    public static void AddRepeat<TSource>(this IList<TSource> list, TSource value, int count);
    
    public static void AddRange<TSource>(this IList<TSource> list, IEnumerable<TSource> items);
  • Inserting methods

    The methods in this section insert a range of items to a list.

    Methods
    public static void InsertRepeat<T>(this IList<T> list, int index, T value, int count);
    
    public static void InsertRange<T>(this IList<T> list, int index, IEnumerable<T> items);
  • Removing methods

    The methods in this section remove a range of items from a list.

    Methods
    public static void RemoveRange<T>(this IList<T> list, int index, int count);
    
    public static void RemoveRange<TSource>(this IList<TSource> list, (int index, int count) range);
  • Taking methods

    The methods in this section remove an item or a range of items from a list and return them to caller.

    Methods
    public static T TakeAt<T>(this IList<T> list, int index);
    
    public static T TakeBound<T>(this IList<T> list, Bound bound);
    
    public static T TakeFirst<T>(this IList<T> list);
    
    public static T TakeLast<T>(this IList<T> list);
    
    public static bool TryTakeBound<T>(this IList<T> list, Bound bound, out T? result);
    
    public static bool TryTakeFirst<T>(this IList<T> list, out T? result);
    
    public static bool TryTakeLast<T>(this IList<T> list, out T? result);
    
    public static IReadOnlyList<T> TakeRange<T>(this IList<T> list, int index, int count);
    
    public static IReadOnlyList<T> TakeRange<T>(this IList<T> list, (int index, int count) range);
  • Replacing methods

    The methods in this section set an item or a range of items in a list and return replaced values to caller.

    Methods
    public static T ReplaceAt<T>(this IList<T> list, int index, T item);
    
    public static T ReplaceBound<T>(this IList<T> list, Bound bound, T item);
    
    public static T ReplaceFirst<T>(this IList<T> list, T item);
    
    public static T ReplaceLast<T>(this IList<T> list, T item);
    
    public static bool TryReplaceBound<T>(this IList<T?> list, Bound bound, T? newItem, out T? oldItem);
    
    public static bool TryReplaceFirst<T>(this IList<T?> list, T? newItem, out T? oldItem);
    
    public static bool TryReplaceLast<T>(this IList<T?> list, T? newItem, out T? oldItem);
    
    public static void ExchangeAt<T>(this IList<T> list, int index, ref T item);
    
    public static void ExchangeBound<T>(this IList<T> list, Bound bound, ref T item);
    
    public static void ExchangeFirst<T>(this IList<T> list, ref T item);
    
    public static void ExchangeLast<T>(this IList<T> list, ref T item);
    
    public static bool TryExchangeBound<T>(this IList<T> list, Bound bound, ref T item);
    
    public static bool TryExchangeFirst<T>(this IList<T> list, ref T item);
    
    public static bool TryExchangeLast<T>(this IList<T> list, ref T item);
    
    public static IReadOnlyList<T> ReplaceRange<T>(this IList<T> list, int index, IEnumerable<T> items);
    
    public static IReadOnlyList<T> ReplaceRange<T>(this IList<T> list, int index, int count, IEnumerable<T> items);
    
    public static IReadOnlyList<T> ReplaceRange<T>(this IList<T> list, (int index, int count) range, IEnumerable<T> items);
  • Moving methods

    The methods in this section move an item or a range of items in a list.

    Methods
    public static void Move<T>(this IList<T> list, int sIndex, int dIndex);
    
    public static void MoveRange<T>(this IList<T> list, int sIndex, int dIndex, int count);
  • Swapping methods

    The methods in this section swap two items or two ranges of items with each other in a list.

    Methods
    public static void Swap<T>(this IList<T> list, int xIndex, int yIndex);
    
    public static void SwapRange<T>(this IList<T> list, int xIndex, int yIndex, int count);
    
    public static void SwapRanges<T>(this IList<T> list, int xIndex, int xCount, int yIndex, int yCount);
  • Reversing methods

    The methods in this section reverse a range of items in a list.

    Methods
    public static void Reverse<T>(this IList<T> list);
    
    public static void Reverse<T>(this IList<T> list, int index);
    
    public static void Reverse<T>(this IList<T> list, int index, int count);
    
    public static void Reverse<T>(this IList<T> list, (int index, int count) range);
  • Sort manipulation methods

    The methods in this section manipulate an item in a sorted list.

    Methods
    public static int AddSorted<T>(this IList<T> list, T item, Comparison<T> comparison, SortingOption option = SortingOption.None);
    
    public static bool InsertSorted<T>(this IList<T> list, int index, T item, Comparison<T> comparison, SortingOption option = SortingOption.None);
    
    public static bool SetSorted<T>(this IList<T> list, int index, T item, Comparison<T> comparison, SortingOption option = SortingOption.None);
  • Filling methods

    The methods in this section fill a range of items in a list.

    Methods
    public static void Fill<TSource>(this IList<TSource> list, TSource value);
    
    public static void Fill<TSource>(this IList<TSource> list, int index, TSource value);
    
    public static void Fill<TSource>(this IList<TSource> list, int index, int count, TSource value);
    
    public static void Fill<TSource>(this IList<TSource> list, (int index, int count) range, TSource value);
    
    public static void Fill<TSource>(this IList<TSource> list, Func<TSource> filler);
    
    public static void Fill<TSource>(this IList<TSource> list, int index, Func<TSource> filler);
    
    public static void Fill<TSource>(this IList<TSource> list, int index, int count, Func<TSource> filler);
    
    public static void Fill<TSource>(this IList<TSource> list, (int index, int count) range, Func<TSource> filler);
    
    public static void Fill<TSource>(this IList<TSource> list, Func<int, TSource> filler);
    
    public static void Fill<TSource>(this IList<TSource> list, int index, Func<int, TSource> filler);
    
    public static void Fill<TSource>(this IList<TSource> list, int index, int count, Func<int, TSource> filler);
    
    public static void Fill<TSource>(this IList<TSource> list, (int index, int count) range, Func<int, TSource> filler);
  • Applying methods

    The methods in this section apply action to a range of items in a list.

    Methods
    public static void Apply<TSource>(this IList<TSource> list, Action<TSource> action);
    
    public static void Apply<TSource>(this IList<TSource> list, int index, Action<TSource> action);
    
    public static void Apply<TSource>(this IList<TSource> list, int index, int count, Action<TSource> action);
    
    public static void Apply<TSource>(this IList<TSource> list, (int index, int count) range, Action<TSource> action);
    
    public static void Apply<TSource>(this IList<TSource> list, ElementAction<TSource> action);
    
    public static void Apply<TSource>(this IList<TSource> list, int index, ElementAction<TSource> action);
    
    public static void Apply<TSource>(this IList<TSource> list, int index, int count, ElementAction<TSource> action);
    
    public static void Apply<TSource>(this IList<TSource> list, (int index, int count) range, ElementAction<TSource> action);
  • Sorting methods

    There are implemented six sorting algorithms: Bubble, Selection, Insertion, Merge, Quick, Heap. For each algorithm, there are many methods with different signatures that are combined from three blocks: sorting data, range of items to be sorted and comparator as delegate or interface. The data to be sorted can be specified as a single list of values or two paired lists of keys and associated values. The sorting range may not be specified, which means the entire list will be sorted. It can be specified by the start index and defined to the end of the list. It can also be specified by the start index and elements count, or by a tuple containing both of these. Below are the method signatures of the list sorting extensions. The Algorithm prefix at the beginning of the method name should be replaced with the name of the sorting algorithm used: Bubble, Selection, Insertion, Merge, Quick, Heap.

    Methods
    public static void AlgorithmSort<TSource>(this IList<TSource> list);
    
    public static void AlgorithmSort<TSource>(this IList<TSource> list, int index);
    
    public static void AlgorithmSort<TSource>(this IList<TSource> list, int index, int count);
    
    public static void AlgorithmSort<TSource>(this IList<TSource> list, (int index, int count) range);
    
    public static void AlgorithmSort<TSource>(this IList<TSource> list, Comparison<TSource>? comparison);
    
    public static void AlgorithmSort<TSource>(this IList<TSource> list, int index, Comparison<TSource>? comparison);
    
    public static void AlgorithmSort<TSource>(this IList<TSource> list, int index, int count, Comparison<TSource>? comparison);
    
    public static void AlgorithmSort<TSource>(this IList<TSource> list, (int index, int count) range, Comparison<TSource>? comparison);
    
    public static void AlgorithmSort<TSource>(this IList<TSource> list, IComparer<TSource>? comparer);
    
    public static void AlgorithmSort<TSource>(this IList<TSource> list, int index, IComparer<TSource>? comparer);
    
    public static void AlgorithmSort<TSource>(this IList<TSource> list, int index, int count, IComparer<TSource>? comparer);
    
    public static void AlgorithmSort<TSource>(this IList<TSource> list, (int index, int count) range, IComparer<TSource>? comparer);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys, int index);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys, int index, int count);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys, (int index, int count) range);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys, Comparison<TKey>? comparison);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys, int index, Comparison<TKey>? comparison);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys, int index, int count, Comparison<TKey>? comparison);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys, (int index, int count) range, Comparison<TKey>? comparison);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys, IComparer<TKey>? comparer);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys, int index, IComparer<TKey>? comparer);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys, int index, int count, IComparer<TKey>? comparer);
    
    public static void AlgorithmSort<TKey, TSource>(this IList<TSource> list, IList<TKey> keys, (int index, int count) range, IComparer<TKey>? comparer);
  • Enumerating methods

    The methods in this section enumerate a range of items from a list.

    Methods
    public static IEnumerable<TSource> Enumerate<TSource>(this IList<TSource> list, bool reverse = false);
    
    public static IEnumerable<TSource> Enumerate<TSource>(this IList<TSource> list, int index, bool reverse = false);
    
    public static IEnumerable<TSource> Enumerate<TSource>(this IList<TSource> list, int index, int count, bool reverse = false);
    
    public static IEnumerable<TSource> Enumerate<TSource>(this IList<TSource> list, (int index, int count) range, bool reverse = false);
  • Copying methods

    The methods in this section copy a range of items from one to another list.

    Methods
    public static void Copy<TSource>(this IList<TSource> srcList, IList<TSource> dstList, bool reverse = false);
    
    public static void Copy<TSource>(this IList<TSource> srcList, IList<TSource> dstList, int dstIndex, int srcIndex, bool reverse = false);
    
    public static void Copy<TSource>(this IList<TSource> srcList, IList<TSource> dstList, int dstIndex, int srcIndex, int count, bool reverse = false);
    
    public static void Copy<TSource>(this IList<TSource> srcList, IList<TSource> dstList, int dstIndex, (int index, int count) srcRange, bool reverse = false);
  • Matching methods

    The methods in this section match a range of items in a list.

    Methods
    public static bool Match<T>(this IList<T> list, Predicate<T> predicate, bool all);
    
    public static bool Match<T>(this IList<T> list, int index, Predicate<T> predicate, bool all);
    
    public static bool Match<T>(this IList<T> list, int index, int count, Predicate<T> predicate, bool all);
    
    public static bool Match<T>(this IList<T> list, (int index, int count) range, Predicate<T> predicate, bool all);
    
    public static bool Match<T>(this IList<T> list, ElementPredicate<T> predicate, bool all);
    
    public static bool Match<T>(this IList<T> list, int index, ElementPredicate<T> predicate, bool all);
    
    public static bool Match<T>(this IList<T> list, int index, int count, ElementPredicate<T> predicate, bool all);
    
    public static bool Match<T>(this IList<T> list, (int index, int count) range, ElementPredicate<T> predicate, bool all);
    
    public static bool MatchAny<T>(this IList<T> list, Predicate<T> predicate);
    
    public static bool MatchAny<T>(this IList<T> list, int index, Predicate<T> predicate);
    
    public static bool MatchAny<T>(this IList<T> list, int index, int count, Predicate<T> predicate);
    
    public static bool MatchAny<T>(this IList<T> list, (int index, int count) range, Predicate<T> predicate);
    
    public static bool MatchAny<T>(this IList<T> list, ElementPredicate<T> predicate);
    
    public static bool MatchAny<T>(this IList<T> list, int index, ElementPredicate<T> predicate);
    
    public static bool MatchAny<T>(this IList<T> list, int index, int count, ElementPredicate<T> predicate);
    
    public static bool MatchAny<T>(this IList<T> list, (int index, int count) range, ElementPredicate<T> predicate);
    
    public static bool MatchAll<T>(this IList<T> list, Predicate<T> predicate);
    
    public static bool MatchAll<T>(this IList<T> list, int index, Predicate<T> predicate);
    
    public static bool MatchAll<T>(this IList<T> list, int index, int count, Predicate<T> predicate);
    
    public static bool MatchAll<T>(this IList<T> list, (int index, int count) range, Predicate<T> predicate);
    
    public static bool MatchAll<T>(this IList<T> list, ElementPredicate<T> predicate);
    
    public static bool MatchAll<T>(this IList<T> list, int index, ElementPredicate<T> predicate);
    
    public static bool MatchAll<T>(this IList<T> list, int index, int count, ElementPredicate<T> predicate);
    
    public static bool MatchAll<T>(this IList<T> list, (int index, int count) range, ElementPredicate<T> predicate);
  • Element index finding methods

    The methods in this section find the index of the element that matches the predicate.

    Methods
    public static int FindIndex<T>(this IList<T> list, Predicate<T> predicate);
    
    public static int FindIndex<T>(this IList<T> list, int index, Predicate<T> predicate);
    
    public static int FindIndex<T>(this IList<T> list, int index, int count, Predicate<T> predicate);
    
    public static int FindIndex<T>(this IList<T> list, (int index, int count) range, Predicate<T> predicate);
    
    public static int FindIndex<T>(this IList<T> list, ElementPredicate<T> predicate);
    
    public static int FindIndex<T>(this IList<T> list, int index, ElementPredicate<T> predicate);
    
    public static int FindIndex<T>(this IList<T> list, int index, int count, ElementPredicate<T> predicate);
    
    public static int FindIndex<T>(this IList<T> list, (int index, int count) range, ElementPredicate<T> predicate);
    
    public static int FindLastIndex<T>(this IList<T> list, Predicate<T> predicate);
    
    public static int FindLastIndex<T>(this IList<T> list, int index, Predicate<T> predicate);
    
    public static int FindLastIndex<T>(this IList<T> list, int index, int count, Predicate<T> predicate);
    
    public static int FindLastIndex<T>(this IList<T> list, (int index, int count) range, Predicate<T> predicate);
    
    public static int FindLastIndex<T>(this IList<T> list, ElementPredicate<T> predicate);
    
    public static int FindLastIndex<T>(this IList<T> list, int index, ElementPredicate<T> predicate);
    
    public static int FindLastIndex<T>(this IList<T> list, int index, int count, ElementPredicate<T> predicate);
    
    public static int FindLastIndex<T>(this IList<T> list, (int index, int count) range, ElementPredicate<T> predicate);
  • Elements finding methods

    The methods in this section find all elements in the range of the list that match the predicate.

    Methods
    public static IEnumerable<T> FindAll<T>(this IList<T> list, Predicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<T> FindAll<T>(this IList<T> list, int index, Predicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<T> FindAll<T>(this IList<T> list, int index, int count, Predicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<T> FindAll<T>(this IList<T> list, (int index, int count) range, Predicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<T> FindAll<T>(this IList<T> list, ElementPredicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<T> FindAll<T>(this IList<T> list, int index, ElementPredicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<T> FindAll<T>(this IList<T> list, int index, int count, ElementPredicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<T> FindAll<T>(this IList<T> list, (int index, int count) range, ElementPredicate<T> predicate, bool reverse = false);
  • Elements indices finding methods

    The methods in this section find all elements in the range of the list that match the predicate and return an enumeration of their indices.

    Methods
    public static IEnumerable<int> FindAllIndices<T>(this IList<T> list, Predicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<int> FindAllIndices<T>(this IList<T> list, int index, Predicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<int> FindAllIndices<T>(this IList<T> list, int index, int count, Predicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<int> FindAllIndices<T>(this IList<T> list, (int index, int count) range, Predicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<int> FindAllIndices<T>(this IList<T> list, ElementPredicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<int> FindAllIndices<T>(this IList<T> list, int index, ElementPredicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<int> FindAllIndices<T>(this IList<T> list, int index, int count, ElementPredicate<T> predicate, bool reverse = false);
    
    public static IEnumerable<int> FindAllIndices<T>(this IList<T> list, (int index, int count) range, ElementPredicate<T> predicate, bool reverse = false);
  • Element index binary searching methods

    The methods in this section perform binary search for the position of an element in a sorted list.

    Methods
    public static int BinarySearch<T>(this IList<T> list, Comparator<T> comparator, SearchingOption option = SearchingOption.None);
    
    public static int BinarySearch<T>(this IList<T> list, int index, Comparator<T> comparator, SearchingOption option = SearchingOption.None);
    
    public static int BinarySearch<T>(this IList<T> list, int index, int count, Comparator<T> comparator, SearchingOption option = SearchingOption.None);
    
    public static int BinarySearch<T>(this IList<T> list, (int index, int count) range, Comparator<T> comparator, SearchingOption option = SearchingOption.None);
  • Element index interpolation searching methods

    The methods in this section perform interpolation search for the position of an element in a sorted list.

    Methods
    public static int InterpolationSearch<T>(this IList<T> list, Comparator<T> comparator, Func<T, T, float> interpolator, SearchingOption option = SearchingOption.None);
    
    public static int InterpolationSearch<T>(this IList<T> list, int index, Comparator<T> comparator, Func<T, T, float> interpolator, SearchingOption option = SearchingOption.None);
    
    public static int InterpolationSearch<T>(this IList<T> list, int index, int count, Comparator<T> comparator, Func<T, T, float> interpolator, SearchingOption option = SearchingOption.None);
    
    public static int InterpolationSearch<T>(this IList<T> list, (int index, int count) range, Comparator<T> comparator, Func<T, T, float> interpolator, SearchingOption option = SearchingOption.None);
  • Sequence comparing methods

    The methods in this section compare elements of two lists. Parameter emptyOrder sets the mode for comparing elements of two sequences with their different lengths. The comparison is performed element by element, and if at the current step the values of the sequences are element by element equal and the end is reached on one of them, then with the RelativeOrder.Lower value, the longer sequence is considered to be greater than the short sequence. With a value of RelativeOrder.Upper, a shorter sequence is considered to be greater than the long sequence.

    Methods
    public static int SequenceCompare<T>(this IList<T> xList, IList<T> yList);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, int count);
    
    public static int SequenceCompare<T>(this IList<T> xList, IList<T> yList, Comparison<T>? comparison);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, Comparison<T>? comparison);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, int count, Comparison<T> comparison);
    
    public static int SequenceCompare<T>(this IList<T> xList, IList<T> yList, IComparer<T>? comparer);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, IComparer<T>? comparer);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, int count, IComparer<T>? comparer);
    
    public static int SequenceCompare<T>(this IList<T> xList, IList<T> yList, RelativeOrder emptyOrder);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, RelativeOrder emptyOrder);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, int count, RelativeOrder emptyOrder);
    
    public static int SequenceCompare<T>(this IList<T> xList, IList<T> yList, Comparison<T>? comparison, RelativeOrder emptyOrder);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, Comparison<T>? comparison, RelativeOrder emptyOrder);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, int count, Comparison<T> comparison, RelativeOrder emptyOrder);
    
    public static int SequenceCompare<T>(this IList<T> xList, IList<T> yList, IComparer<T>? comparer, RelativeOrder emptyOrder);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, IComparer<T>? comparer, RelativeOrder emptyOrder);
    
    public static int SequenceCompare<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, int count, IComparer<T>? comparer, RelativeOrder emptyOrder);
  • Sequence equaling methods

    The methods in this section compare elements of two lists for equality.

    Methods
    public static bool SequenceEqual<T>(this IList<T> xList, IList<T> yList);
    
    public static bool SequenceEqual<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex);
    
    public static bool SequenceEqual<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, int count);
    
    public static bool SequenceEqual<T>(this IList<T> xList, IList<T> yList, Equality<T> equality);
    
    public static bool SequenceEqual<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, Equality<T>? equality);
    
    public static bool SequenceEqual<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, int count, Equality<T>? equality);
    
    public static bool SequenceEqual<T>(this IList<T> xList, IList<T> yList, IEqualityComparer<T>? equalityComparer);
    
    public static bool SequenceEqual<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, IEqualityComparer<T>? equalityComparer);
    
    public static bool SequenceEqual<T>(this IList<T> xList, int xIndex, IList<T> yList, int yIndex, int count, IEqualityComparer<T>? equalityComparer);

Clone this wiki locally