Example #1
0
        public static void AsyncSorting <T>(T[] array, SortingSomething <T> compare, Action CallbeckMetod)
        {
            Thread go = new Thread
                        (
                () =>
            {
                Sorting(array, compare, CallbeckMetod);
            }
                        );

            go.Start();
        }
Example #2
0
 public static void Sorting <T>(T[] a, SortingSomething <T> compare, Action CallbeckMetod)
 {
     for (int i = 0; i < a.Length; i++)
     {
         for (int j = i + 1; j < a.Length; j++)
         {
             if (compare(a[j], a[i]) < 0)
             {
                 var temp = a[i];
                 a[i] = a[j];
                 a[j] = temp;
                 Console.WriteLine($"Elements {a[i]} and {a[j]} was swap.");
                 Thread.Sleep(TimeSpan.FromSeconds(0.5));
             }
         }
     }
     CallbeckMetod();
 }