Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Lab4;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace StudentService
- {
- public class StudentMethodService
- {
- private Student[] students = StudentFactory.Create();
- public List<Student> AgeBigger19()
- {
- IList<Student> studentsList = students;
- var teenAgerStudents = studentsList.Where(s => s.age > 19)
- .ToList<Student>();
- return teenAgerStudents;
- }
- public List<Student> AgeBetween18and22()
- {
- IList<Student> studentsList = students;
- var teenAgerStudents = studentsList.Where(s => s.age > 18 && s.age < 22)
- .ToList<Student>();
- return teenAgerStudents;
- }
- public int CountNamesThatContainJ()
- {
- IList<Student> studentsList = students;
- var teenAgerStudents = studentsList.Count(s => s.StudentName.Contains("J");
- return teenAgerStudents;
- }
- public int CountNamesThatContainl()
- {
- IList<Student> studentsList = students;
- var teenAgerStudents = studentsList.Count(s => s.StudentName.Contains("l");
- return teenAgerStudents;
- }
- public List<Student> AgeBetween18and22()
- {
- IList<Student> studentsList = students;
- var teenAgerStudents = studentsList.Select(s => new { Name = s.StudentName, Age = s.age }).Where(s => s.Age == 17);
- return teenAgerStudents;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement