Exemplo n.º 1
0
            public void Sort(Func <dynamic, dynamic, bool> сomparisonMethod)
            {
                for (int i = 0; i < this.array.Length; i++)
                {
                    for (int j = i + 1; j < this.array.Length; j++)
                    {
                        if (сomparisonMethod != null)
                        {
                            if (сomparisonMethod(array[i], this.array[j]))
                            {
                                Swap(i, j);
                            }
                        }
                    }

                    if (i == this.array.Length - 1)
                    {
                        EndSort?.Invoke(this, new Message(string.Join(": ", new string[] { "Сортировка завершена", string.Join(", ", this.array) })));
                    }
                }
            }
Exemplo n.º 2
0
 public static void RunMySort(string[] str, TypeComparer typeComparer)
 {
     Console.WriteLine("Запуск сортировки.");
     MySort(str, typeComparer);
     EndSort?.Invoke(str, EventArgs.Empty);
 }