Exemplo n.º 1
0
 public static void printStudents(Students[] students)
 {
     foreach (var student in students)
     {
         Console.WriteLine(student);
     }
 }
Exemplo n.º 2
0
 public static void GetStudentsWithEmailInAbv(Students[] students)
 {
     var newStudents =
        from student in students
        where student.Email.Contains("@abv.bg")
        select student;
     printStudents(newStudents.ToArray());
 }
Exemplo n.º 3
0
 public static void GetStudentsWithPhoneInSofia(Students[] students)
 {
     var newStudents =
        from student in students
        where student.Telephone.StartsWith("02")
        select student;
     printStudents(newStudents.ToArray());
 }
Exemplo n.º 4
0
 public static void GetStudentsComparedByAgeBetween18And24(Students[] students)
 {
     var newStudents =
            from student in students
            where student.Age >= 18 && student.Age <=24
            select student;
         printStudents(newStudents.ToArray());
 }
Exemplo n.º 5
0
 public static void GetStudentsFromGroup2(Students[] students)
 {
     var newStudents =
        from student in students
        where student.GroupNumber == 2
        orderby student.FirstName
        select student;
     printStudents(newStudents.ToArray());
 }
Exemplo n.º 6
0
 public static void GetStudentsEnrolledIn2006(Students[] students)
 {
     var newStudents =
        from student in students
        where student.FacultyNumber.EndsWith("06")
        select student;
     foreach (var student in newStudents)
     {
         Console.WriteLine(student + " - marks: " + string.Join(", ",student.Marks));
     }
 }
Exemplo n.º 7
0
        public static List<ExcellentStudents> GetStudentsWithAtLeastOneExcellentMark(Students[] students)
        {
            List<ExcellentStudents> excellentStudents = new List<ExcellentStudents>();
            var newStudents =
               from student in students
               where student.Marks.Contains(6)
               select student;

            foreach (var student in newStudents)
            {
                var execellentStudent = new ExcellentStudents(student.FirstName + " " + student.LastName, student.Marks);
                excellentStudents.Add(execellentStudent);
            }
            return excellentStudents;
        }
Exemplo n.º 8
0
 public static void GetStudentsComparedByLastName(Students[] students)
 {
     var newStudents =
            from student in students
            where student.FirstName.CompareTo(student.LastName) < 0
            select student;
         printStudents(newStudents.ToArray());
 }