Proposal: simplifying nullable boolean expressions #8033
Unanswered
michalczerwinski
asked this question in
Language Ideas
Replies: 2 comments
-
See: #2861 |
Beta Was this translation helpful? Give feedback.
0 replies
-
public static implicit extension NullableBooleanExtension for bool?
{
public static bool operator true(bool? val) => /*logic*/
public static bool operator false(bool? val) => /*logic*/
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently if I want to use some nullable bool in if expression we have to explicitly compare it to true or false:
It would be really nice to be able to simplify it to:
Perhaps it can be achieved by implicit conversion operator for Nullable? Or some other techniques can be applied?
Beta Was this translation helpful? Give feedback.
All reactions