Created
November 14, 2019 22:09
-
-
Save diedona/c75bfafe4f7d25b001cef26d1b90a469 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Person | |
{ | |
public Guid Id { get; private set; } | |
public string FullName { get; private set; } | |
public DateTime BirthDate { get; private set; } | |
public string Email { get; private set; } | |
public string PhoneNumber { get; private set; } | |
public string Tribe { get; private set; } | |
public PreferredCommunication PreferredCommunication { get; private set; } | |
public Person(string fullName, DateTime birthDate, string email, string phoneNumber, string tribe, PreferredCommunication communication = PreferredCommunication.Email) | |
{ | |
Id = Guid.NewGuid(); | |
FullName = fullName; | |
BirthDate = birthDate; | |
Email = email; | |
PhoneNumber = phoneNumber; | |
PreferredCommunication = communication; | |
if (this.BirthDate > DateTime.Now) | |
{ | |
throw new ArgumentOutOfRangeException("BirthDate", "Future dates not allowed"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment