コード例 #1
0
ファイル: Program.cs プロジェクト: zhaoqiyu/AntraHomework
        static void Main(string[] args)
        {
            Person p1 = new Person();
            Student s1 = new Student();
            Teacher t1 = new Teacher();
            p1.Greet();
            s1.SetAge(21);
            s1.Greet();
            s1.ShowAge();
            t1.SetAge(30);
            t1.Greet();
            t1.Explain();

            Console.ReadKey();
        }
コード例 #2
0
ファイル: Test.cs プロジェクト: stefan-petrov/TelerikAcademy
        static void Main(string[] args)
        {
            Student st1 = new Student("Pesho", "Georgiev", 18);
            Student st2 = new Student("Pesho", "Yanakiev", 19);
            Student st3 = new Student("Rosen", "Ivanov", 14);
            Student st4 = new Student("Rosen", "Temelkov", 25);

            Student[] stArray = new Student[4];
            stArray[0] = st1;
            stArray[1] = st2;
            stArray[2] = st3;
            stArray[3] = st4;

            var sortQuery =
                from student in stArray
                where student.Age >= 18 && student.Age <=24
                select student;

            foreach (var item in sortQuery)
            {
                Console.WriteLine(item.FirstName + " " + item.SecondName);
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: nickern/.Net-Exercise4
 private static void AddStudent(string firstName, string lastName, int course)
 {
     
         Student student = new Student { FirstName = firstName, LastName = lastName };
         db.Students.Add(student);
         db.Courses.Find(course).Students.Add(student);
         db.SaveChanges();
         Console.WriteLine("Student: " + student.FirstName + " " + student.LastName + " added!");
         ReturnMenu();
     
 }