Exemple #1
0
        //[5.2]
        public static Student[] DescendingSort(Student[] list)
        {
            var Desc =
                from person in list
                orderby person.FirstName descending, person.LastName descending
                select person;

            return Desc.ToArray<Student>();
        }
Exemple #2
0
        //[3]
        public static Student[] FirstBeforeLastName(Student[] list)
        {
            var firstLastName =
                from person in list
                where string.Compare(person.FirstName, person.LastName) < 0
                select person;

            return firstLastName.ToArray<Student>();
        }
Exemple #3
0
        //[4]
        public static Student[] Between18And24(Student[] list)
        {
            var from18To24 =
                from person in list
                where ((person.Age() >= 18) && (person.Age() <= 24))
                select person;

            return from18To24.ToArray<Student>();
        }
Exemple #4
0
 //[5.1]
 public static Student[] SortDesc(Student[] list)
 {
     var Sort = list.OrderByDescending(s => s.FirstName).ThenByDescending(s => s.LastName);
     return Sort.ToArray<Student>();
 }