Last active
August 29, 2015 14:05
-
-
Save mikebranstein/5b5f6613074334255705 to your computer and use it in GitHub Desktop.
Person Rich Object Domain
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
class Person { | |
public string FirstName { get; private set; } | |
public string LastName { get; private set; } | |
public Person(string firstName, string lastName) { | |
ChangeName(firstName, lastName); | |
} | |
public void ChangeName(string firstName, string lastName) { | |
if (firstName == null) throw new ArgumentException("firstName cannot be null"); | |
if (lastName == null) throw new ArgumentException("lastName cannot be null"); | |
FirstName = firstName; | |
LastName = lastName; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment