Last active
February 25, 2016 20:33
-
-
Save scottheckel/7ad768d171e8f38022b4 to your computer and use it in GitHub Desktop.
yay/nay
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 Brulean | |
{ | |
private string Value { get; set; } = "nay"; | |
public static implicit operator bool(Brulean brul) | |
{ | |
return brul.Value == "yay"; | |
} | |
public static implicit operator Brulean(bool value) | |
{ | |
return new Brulean { Value = value ? "yay" : "nay" }; | |
} | |
public static implicit operator string(Brulean brul) | |
{ | |
return brul.ToString(); | |
} | |
public static implicit operator Brulean(string value) | |
{ | |
return new Brulean { Value = value == "yay" ? "yay" : "nay" }; | |
} | |
public override string ToString() | |
{ | |
return Value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yay!