示例#1
0
        static void Main(string[] args)
        {
            {
                StudentService service = new StudentService();
                service.Add(new Student
                {
                    Name     = "Karl",
                    Age      = 54,
                    LastName = "Marx"
                });
                service.Add(new Student
                {
                    Name     = "Petro",
                    Age      = 22,
                    LastName = "Petrenko"
                });

                Random rand = new Random();
                foreach (Student item in service.Students)
                {
                    item.AddMark("C++", rand.Next(1, 12));
                    item.AddMark("C#", rand.Next(1, 12));
                }
            }
        }
示例#2
0
文件: Program.cs 项目: Basialex/Step
        static void Main(string[] args)
        {
            StudentService service = new StudentService();

            service.Add(new Student
            {
                Name     = "Karl",
                Age      = 54,
                LastName = "Marx"
            });
            Random rand = new Random();

            foreach (Student item in service.Students)
            {
                item.AddMark("Biology", rand.Next(1, 12));
                item.AddMark("Physic", rand.Next(1, 12));
            }
            foreach (Student item in service.Students)
            {
                Console.WriteLine("Name :" + item.Name + "Age :" + item.Age + "");
            }
        }