Skip to content

Instantly share code, notes, and snippets.

@rofr
Created October 1, 2013 00:24
Show Gist options
  • Save rofr/6772283 to your computer and use it in GitHub Desktop.
Save rofr/6772283 to your computer and use it in GitHub Desktop.
Immutable domain entity
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