Esempio n. 1
0
 public Person(string firstName, string lastName, DateTime birthDate, int age, ContactInformation contactInformation)
 {
     FirstName          = firstName;
     LastName           = lastName;
     BirthDate          = birthDate;
     ContactInformation = contactInformation;
     Age = age;
 }
Esempio n. 2
0
        private static void createPerson(string firstName, string lastName, DateTime birthDate, ContactInformation contactInformation)
        {
            TimeSpan timeSpanAge = DateTime.Now.Subtract(birthDate);
            int      age         = timeSpanAge.Days / 365;
            Person   person      = new Person(firstName, lastName, birthDate, age, contactInformation);

            persons.Add(person);
            Console.WriteLine("Personer: ");
            Console.WriteLine($"Fornavn: {firstName}");
            Console.WriteLine($"Efternavn: {lastName}");
            Console.WriteLine($"Fødselsdato: {birthDate.ToString("dd-MM-yyyy")}");
            Console.WriteLine($"Alder: {age}");
            Console.WriteLine($"Mail: {contactInformation.Mail}");
            Console.WriteLine($"Telefonnummer: {contactInformation.Phone}\n");
        }