Example #1
0
        public static async Task BeginSort(T[] array, Func <T, T, int> compare, int start, int stop, Action <object> callback, object callbackInput)
        {
            SortStopped += callback;
            await Task.Run(() => SortD.Sort(array, compare, start, stop));

            SortStopped?.Invoke(callbackInput);
        }
Example #2
0
        private static void Main(string[] args)
        {
            var array = new[] { "three", "two", "o", "a", "b" };
            Func <string, string, int> compare = (x, y) =>
            {
                if (x.Length != y.Length)
                {
                    return((x.Length - y.Length) / Math.Abs(x.Length - y.Length));
                }
                return(x.CompareTo(y));
            };

            SortD.Sort(array, compare, 0, array.Length - 1);
            foreach (var item in array)
            {
                Console.WriteLine(item);
            }
        }
Example #3
0
 public static void Sort(T[] array, Func <T, T, int> compare, int start, int stop) => SortD.Sort(array, compare, start, stop);