static void Main(string[] args) { int[] intArray = new int[] { 5, 2, 3, 1, 0, 4 }; SortObject so = new SortObject(intArray); so.Sort(AscendingCompare); //오름차순 정렬을 할 수 있는 메서드 전달 so.Display(); Console.WriteLine(); so.Sort(DescendingCompare); //내림차순 정렬을 할 수 있는 메서드 전달 so.Display(); }
static void Main(string[] args) { Person[] personArray = new Person[] { new Person(51, "Anders"), new Person(37, "Scott"), new Person(45, "Peter"), new Person(62, "Mads"), }; SortObject so = new SortObject(personArray); so.Sort(AscSortByName); so.Display(); }