/// <summary> /// Sorts the strings of two dimensional array /// </summary> /// <param name="array">Array that we sort</param> /// <param name="sorter">Method of sorting</param> /// <returns>Sorted array</returns> /// <exception cref="NullReferenceException"></exception> public static int[][] Sort(int[][] array, IArraySorter sorter) { if (ReferenceEquals(array, null) || ReferenceEquals(sorter, null)) { throw new NullReferenceException(); } for (int i = array.Length - 1; i > 0; i--) { for (int j = 0; j < i; j++) { if (sorter.CompareRows(array[j], array[j + 1]) < 0) { ChangeRows(ref array[j], ref array[j + 1]); } } } return(array); }
protected override object Execute(IArraySorter <DateTime> profiledObject, DateTime[] inputData) { profiledObject.Sort(inputData); return(inputData); }
////public StudentsSorter() ////{ //// this.studentSorter = new CustomArraySorter<Student>(); ////} public StudentsSorter(IArraySorter<Student> studentSorter) { this.studentSorter = studentSorter; }