Esempio n. 1
0
        static void Main()
        {
            var students      = StudentsInformation.StudentInfo();
            var studentsByAge = from student in students
                                where student.Age >= 18 && student.Age <= 24
                                select new { student.FirstName, student.LastName, student.Age };

            foreach (var student in studentsByAge)
            {
                Console.WriteLine("Student: {0} {1}\nAge: {2}",
                                  student.FirstName, student.LastName, student.Age);
                Console.WriteLine();
            }
        }
Esempio n. 2
0
        static void Main()
        {
            var students       = StudentsInformation.StudentInfo();
            var filteredEmails = from student in students
                                 where student.Email.Contains("@abv.bg")
                                 select student;

            foreach (var student in filteredEmails)
            {
                string marks = String.Join(", ", student.Marks);
                Console.WriteLine("Student: {0} {1},\nAge: {2} \nFactualy number: {3}, \nPhone: {4}, \nEmail: {5}, \nMarks: ({6}), \nGroup number: {7}",
                                  student.FirstName, student.LastName, student.Age, student.FacultyNumber, student.Phone, student.Email,
                                  marks, student.GroupNumber);
                Console.WriteLine();
            }
        }
Esempio n. 3
0
        static void Main()
        {
            var students = StudentsInformation.StudentInfo();
            var groupTwo = students
                           .Where(a => a.GroupNumber == 2)
                           .OrderBy(a => a.FirstName);

            foreach (var student in groupTwo)
            {
                string marks = String.Join(", ", student.Marks);
                Console.WriteLine("Student: {0} {1},\nAge: {2} \nFactualy number: {3}, \nPhone: {4}, \nEmail: {5}, \nMarks: ({6}), \nGroup number: {7}",
                                  student.FirstName, student.LastName, student.Age, student.FacultyNumber, student.Phone, student.Email,
                                  marks, student.GroupNumber);
                Console.WriteLine();
            }
        }