Nicer code for toggling a bool member
c#
Solution
No. That's the optimal way. Congratulations!
Even IF there would be an other way (as you commented - `_isIt!!`), I believe that it would be better not to use it because you'd be raising a lot of eyebrows anyway.
Problem
Please note that the question isn't about negating a boolean value but rather about the most elegant, efficient and nicest way of doing so. Upon a click on a toggle button, I execute the following code to store the new state in a private `bool`. ``` _isIt = !_isIt; ``` It works, sure. It's readable, sure. But so is `i = i + 1`, still, we always write `i++`. Is there a neater way to toggle a `bool`?