Created
October 1, 2013 00:24
-
-
Save rofr/6772283 to your computer and use it in GitHub Desktop.
Immutable domain entity
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 SquashPlayer | |
{ | |
public readonly string Name; | |
public readonly int Ranking; | |
public SquashPlayer(string name, int ranking) | |
{ | |
Name = name; | |
Ranking = ranking; | |
} | |
public SquashPlayer WithRanking(int newRanking) | |
{ | |
if (newRanking != Ranking) return new SquashPlayer(Name, newRanking); | |
else return this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment