/// <summary> /// Returns a lexicographic sequence comparer, which compares each element according to its position, from first to /// last. /// </summary> /// <typeparam name="T">The type of element being compared. Must be IComparable[T].</typeparam> /// <returns></returns> public static IComparer <IEnumerable <T> > LexSequenceComparer <T>() where T : IComparable <T> { return(CreateComparer <IEnumerable <T> >((x, y) => EqualityHelper.SeqCompareLex(x, y))); }
/// <summary> /// Determines whether this sequence is bigger than the other using lexicographic comparison. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="self"></param> /// <param name="other"></param> /// <returns></returns> public static int LexCompare <T>(this IEnumerable <T> self, IEnumerable <T> other) where T : IComparable <T> { return(EqualityHelper.SeqCompareLex(self, other)); }
/// <summary> /// Returns a lexicographic sequence comparer, which compares each element according to its position, from first to /// last. /// </summary> /// <param name="comparer">The comparer used to compare each element of the sequence.</param> /// <returns></returns> public static IComparer <IEnumerable <T> > LexSequenceComparer <T>(IComparer <T> comparer) { return(CreateComparer <IEnumerable <T> >((x, y) => EqualityHelper.SeqCompareLex(x, y, comparer))); }
/// <summary> /// Determines whether this sequence is bigger than the other using a lexicographic comparison (comparing each element /// based on its position, from first to last). /// </summary> /// <typeparam name="T"></typeparam> /// <param name="self"></param> /// <param name="other"></param> /// <param name="comparer"></param> /// <returns></returns> public static int LexCompare <T>(this IEnumerable <T> self, IEnumerable <T> other, IComparer <T> comparer) { return(EqualityHelper.SeqCompareLex(self, other, comparer)); }