Forked from yreynhout/KeepImmutableSanity_Classic.cs
Last active
December 17, 2015 10:59
-
-
Save ploeh/5599253 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ImmutableXYZ { | |
public ImmutableXYZ() : this("", 0, -1) { | |
} | |
private ImmutableXYZ(string abc, int def, int haha) | |
{ | |
this.abc = abc; | |
this.def = def; | |
this.haha = haha; | |
} | |
public ImmutableXYZ WithABC(string value) { | |
return new ImmutableXYZ(value, this.def, this.haha); | |
} | |
public ImmutableXYZ WithDEF(int value) { | |
return new ImmutableXYZ(this.abc, value, this.haha); | |
} | |
public ImmutableXYZ WithHaha(int value) { | |
return new ImmutableXYZ(this.abc, this.def, value); | |
} | |
public readonly string ABC; | |
public readonly int DEF; | |
private readonly int haha; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment