SHARE
TWEET

Untitled

a guest Oct 21st, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using Lab4;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6.  
  7. namespace StudentService
  8. {
  9.     public class StudentMethodService
  10.     {
  11.      private Student[] students = StudentFactory.Create();
  12.  
  13.      public List<Student> AgeBigger19()
  14.      {
  15.        IList<Student> studentsList = students;
  16.  
  17.        var teenAgerStudents = studentsList.Where(s => s.age > 19)
  18.                               .ToList<Student>();
  19.  
  20.  
  21.             return teenAgerStudents;
  22.      }
  23.  
  24.     public List<Student> AgeBetween18and22()
  25.     {
  26.             IList<Student> studentsList = students;
  27.  
  28.             var teenAgerStudents = studentsList.Where(s => s.age > 18 && s.age < 22)
  29.                                    .ToList<Student>();
  30.  
  31.  
  32.             return teenAgerStudents;
  33.     }
  34.  
  35.     public int CountNamesThatContainJ()
  36.     {
  37.             IList<Student> studentsList = students;
  38.  
  39.             var teenAgerStudents = studentsList.Count(s => s.StudentName.Contains("J");
  40.  
  41.  
  42.             return teenAgerStudents;
  43.     }
  44.  
  45.     public int CountNamesThatContainl()
  46.     {
  47.             IList<Student> studentsList = students;
  48.  
  49.             var teenAgerStudents = studentsList.Count(s => s.StudentName.Contains("l");
  50.  
  51.  
  52.             return teenAgerStudents;
  53.     }
  54.  
  55.     public List<Student> AgeBetween18and22()
  56.      {
  57.          IList<Student> studentsList = students;
  58.  
  59.             var teenAgerStudents = studentsList.Select(s => new { Name = s.StudentName, Age = s.age }).Where(s => s.Age == 17);
  60.  
  61.         return teenAgerStudents;
  62.     }
  63.  
  64.     }
  65.  
  66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top