예제 #1
0
        static void Main(string[] args)
        {
            UniversityManager um = new UniversityManager();

            //um.MaleStudents();
            //um.femaleStudents();
            //um.SortStudentByAge();
            //um.AllStudentsFromBeijingTech();
            um.StudenAndUniversityNameCollection();
            int[]             someInts    = { 34, 15, 48, 10, 5, 6, 3, 77, 90 };
            IEnumerable <int> sortedInts  = from i in someInts orderby i select i;
            IEnumerable <int> reverseInts = sortedInts.Reverse();

            foreach (var i in reverseInts)
            {
                Console.WriteLine(i);
            }

            IEnumerable <int> reversedSortedInts = from i in someInts orderby i descending select i;

            foreach (var i in reversedSortedInts)
            {
                Console.Write($"{i} ");
            }



            Console.ReadLine();
        }
예제 #2
0
파일: Program.cs 프로젝트: Intercisa/dotNET
        static void Main(string[] args)
        {
            UniversityDataFillHelper();
            UniversityManager universityManager = new UniversityManager(universities, students);

            universityManager.MaleStudents();
            universityManager.FemaleStudents();
            universityManager.LmbtqStudents();
            universityManager.PrintStudentsBasedOnGender("female");

            universityManager.SortStudentsByAge();

            universityManager.AllStudentsFromBejingTech();
            universityManager.AllStudentsFromSpecificuniversity(1);

            /*
             * Console.WriteLine("(INPUT) University Id: ");
             * var input = Console.ReadLine();
             * int inputNum;
             *
             * if (int.TryParse(input, out inputNum) && (inputNum == 1 || inputNum == 2))
             *  universityManager.AllStudentsFromSpecificuniversity(inputNum);
             * else
             *  Console.WriteLine("Wrong input. Try again!");
             *
             */

            int[]             someInts    = { 30, 12, 4, 3, 12 };
            IEnumerable <int> sortedInts  = from i in someInts orderby i select i;
            IEnumerable <int> reversedInt = sortedInts.Reverse();

            foreach (int i in reversedInt)
            {
                Console.WriteLine(i);
            }

            IEnumerable <int> reversedSortedInts = from i in someInts
                                                   orderby i descending
                                                   select i;

            foreach (int i in reversedSortedInts)
            {
                Console.WriteLine(i);
            }
            Console.WriteLine("----------------------------------------");

            universityManager.StudentsAndUniversitiesNameCollection();
        }