コード例 #1
0
        private static void DemoAttributeAssociationUniversitySided()
        {
            var user = new User("mich", new DateTime(1990, 10, 19));
            var uni  = new University("PJATK");

            uni.AddUser(user, false, "CS", DateTime.Today);
            try
            {
                uni.AddUser(user, false, "CS", DateTime.Today);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                uni.AddUser(null, false, "Physics", DateTime.Today);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            uni.AddUser(user, false, "Biology", new DateTime(1990, 1, 1));
            user.UniversityAttendances.ForEach(Console.WriteLine);
            uni.UniversityAttendances.ForEach(Console.WriteLine);
        }