Skip to content

Instantly share code, notes, and snippets.

@diedona
Created November 14, 2019 22:09
Show Gist options
  • Save diedona/c75bfafe4f7d25b001cef26d1b90a469 to your computer and use it in GitHub Desktop.
Save diedona/c75bfafe4f7d25b001cef26d1b90a469 to your computer and use it in GitHub Desktop.
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