Example #1
0
        static void Main()
        {
            // creating an instance of the StudentsDirectory class, so that we can use its IList<Student>
            StudentsDirectory database = new StudentsDirectory();

            // running LINQ query
            var studentsByPhoneQuery = database.Students.StudentsByPhoneQuery();

            // printing - by invoking the PrintStudentsInfo() method from the StudentsByFirstAndLastName project
            StudentsByFirstAndLastName.PrintStudentsInfo(studentsByPhoneQuery);
        }
Example #2
0
    static void Main()
    {
        // creating an instance of the StudentsDirectory class, so that we can use its IList<Student>
        StudentsDirectory database = new StudentsDirectory();

        // using lambda expressions
        var sortedStudents =
            database.Students.OrderByDescending(student => student.FirstName).ThenBy(student => student.LastName);

        // running LINQ query
        var studentsSortQuery = database.Students.StudentsSortQuery();

        // printing - by invoking the PrintStudentsInfo() method from the StudentsByFirstAndLastName project
        StudentsByFirstAndLastName.PrintStudentsInfo(sortedStudents);
        Console.WriteLine();
        StudentsByFirstAndLastName.PrintStudentsInfo(studentsSortQuery);
    }