/// <summary> /// Returns a new Query representing the original elements but in reverse order. /// /// For example: /// (1, 2, 3).Query().Reverse() /// Would result in: /// (3, 2, 1) /// </summary> public static Query <T> Reverse <T>(this Query <T> query) { T[] array; int count; query.Deconstruct(out array, out count); KhalreonUtility.Reverse(array, 0, count); return(new Query <T>(array, count)); }
/// <summary> /// Returns a new Query with the elements of the original query in reverse sorted order. /// </summary> public static Query <T> SortDescending <T>(this Query <T> query) where T : IComparable <T> { T[] array; int count; query.Deconstruct(out array, out count); Array.Sort(array, 0, count); KhalreonUtility.Reverse(array, 0, count); return(new Query <T>(array, count)); }