C#, quick way to invert a nullable bool?
c#
Solution
`myBool = !myBool;`
Edit: OK, based on a refined understanding of the question (i.e. `myBool` says null if it was null), the above is the simplest answer.
Problem
I have a nullable bool. What is a quick way to invert it. In otherwords if value is TRUE make it FALSE, otherwise make it TRUE. To clarify (from the comments): Expected behavior is: if the nullable bool has a value, then invert, otherwise should return null.