Created
November 2, 2015 13:29
-
-
Save Steinblock/10df18afb948866be1ba to your computer and use it in GitHub Desktop.
Answer
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 enum Answers | |
{ | |
No, | |
Yes, | |
} | |
public struct Answer | |
{ | |
public Answer(Answers answer) | |
{ | |
this.Value = answer; | |
} | |
public readonly Answers Value; | |
public static bool operator !(Answer x) | |
{ | |
return !(x.Value == Answers.Yes); | |
} | |
public override string ToString() | |
{ | |
if (!this) | |
return "No"; | |
else | |
return "Yes"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment