コード例 #1
0
 static void Main()
 {
     StudentDirectory database = new StudentDirectory();
     var studentsEnrolled = from student in database.Students
                            where ((student.FacultyNumber / 1000) % 100) == 14
                            select student;
     Print.PrintStudentsInfo(studentsEnrolled);
 }
コード例 #2
0
 static void Main()
 {
     StudentDirectory database = new StudentDirectory();
     var sortWeakStudents = database.Students.SortWeakStudents();
     foreach (var student in sortWeakStudents)
     {
         Console.WriteLine(student.FirstName + " "+ string.Join(" ", student.Marks));
     }
 }
コード例 #3
0
 static void Main()
 {
     StudentDirectory database = new StudentDirectory();
         var exellentStudents = from student in database.Students
                                where student.Marks.Contains(6)
                                select new { fullName = string.Join(" ", student.FirstName, student.LastName), marks = string.Join(" ", student.Marks) };
         foreach (var student in exellentStudents)
         {
             Console.WriteLine("Name: {0} , Grades: {{{1}}}", student.fullName, student.marks);
         }
 }
コード例 #4
0
 public static void Main()
 {
     StudentDirectory studentDB = new StudentDirectory();
     SpecialtyDirectory specialtyDB = new SpecialtyDirectory();
     var specialtyQ = from student in studentDB.Students
                     orderby student.FirstName ascending, student.LastName ascending
                     join specialty in specialtyDB.specialies on student.FacultyNumber equals specialty.FacultyNumber
                     select new { student.FirstName, student.LastName, student.FacultyNumber, specialty.SpecialtyName };
     foreach (var student in specialtyQ)
     {
         Console.WriteLine("{0} {1} {2} {3}", student.FirstName, student.LastName, student.FacultyNumber, student.SpecialtyName);
     }
 }
コード例 #5
0
 static void Main()
 {
     StudentDirectory database = new StudentDirectory();
     var studentByGroupsQuery = from student in database.Students
                                group student by student.GroupName
                                    into specialties
                                    select specialties;
     foreach (var group in studentByGroupsQuery)
     {
         Console.WriteLine("{0}",group.Key);
         foreach (var student in group)
         {
             Console.WriteLine("{0} {1} {2}",student.FirstName, student.LastName, student.FacultyNumber);
         }
     }
 }
コード例 #6
0
        static void Main(string[] args)
        {
            StudentDirectory dB = new StudentDirectory();
            string pattern = @"(?<=\w\@)abv\.bg?()";
            Regex rgx = new Regex(pattern);
            var abv = dB.Students.Where(email => rgx.IsMatch(email.Email));
            var abvEmails = from student in dB.Students
                            where rgx.IsMatch(student.Email)
                            select student;

            Console.WriteLine("Lambda");
            foreach (var student in abv)
            {                
                Console.WriteLine("{0} {1} {2}",student.FirstName, student.LastName, student.Email);
            }

            Console.WriteLine();
            Console.WriteLine("LINQ"");
            foreach (var student in abvEmails)
            {                               
                Console.WriteLine("{0} {1} {2}", student.FirstName, student.LastName, student.Email);
            }
        }
コード例 #7
0
 public static void Main()
 {
     StudentDirectory database = new StudentDirectory();
     database.Students.PrintStudentsInfo();
 }
コード例 #8
0
 static void Main()
 {
     StudentDirectory database = new StudentDirectory();
         var sortByPhone = database.Students.SortByPhone();
         Print.PrintStudentsInfo(sortByPhone);
 }
コード例 #9
0
 public static void Main()
 {
     StudentDirectory database = new StudentDirectory();
     var studentsByNames = database.Students.StudentsByNames();
     PrintStudentsByNames(studentsByNames);
 }
コード例 #10
0
 public static void Main()
 {
     StudentDirectory database = new StudentDirectory();
     var studentsByAge = database.Students.StudentsByAge();
     PrintStudentsByAge(studentsByAge);
 }