/// <summary> /// Method that sorts arrays /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Sortingarrays(object sender, EventArgs e) { try { int[] mas = Validatearrays.ValidateAndConvert(FirstArgument.Text); string nameButton = ((Button)sender).Name; ISorters sorter = FactorySorters.GetSorting(nameButton); int[] array = sorter.Sort(mas); string result = ""; for (int j = 0; j < array.Length; j++) { result += Convert.ToString(array[j] + " "); } Result.Text = result; } catch (Exception exception) { MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }