コード例 #1
0
        static void Main()
        {
            Student1 stud1 = new Student1(1, "Kavin", Convert.ToDateTime("1998-07-31"));//Student COnstructor Para
            //  or DateTime.ParseExact("1998-07-27", "yyyy-MM-dd", null)
            Student1 stud2 = new Student1(2, "Kanav", DateTime.ParseExact("1997-12-31", "yyyy-MM-dd", null));
            DateTime dt2   = new DateTime(2015, 12, 31);
            Student1 stud3 = new Student1(1, "Sumedha", dt2);

            StudentInfo info = new StudentInfo();//Student1 default constructor and then StudentInfo Default Constructor


            info.display(stud1);
            info.display(stud2);
            info.display(stud3);
        }
コード例 #2
0
 public void display(Student1 student)
 {
     Console.WriteLine("ID=" + student.Id + " Name=" + student.Name + " Date of birth=" + student.Dateofbirth);
     Console.ReadKey();
 }