I have this line of code
bool b1 = true; bool b2 = true; bool b3 = true; bool areDifferent = b1 ^ b2 ^ b3;
which works, if there are only 2 booleans (true XOR true) // false
but it doesn't work with n booleans (true XOR true XOR true) // true
Question: What is the correct generic way to determine if all values are equal (or are not) with C# logic operators (AND, OR, XOR, XNOR)
https://stackoverflow.com/questions/65822793/determine-difference-with-logic-operators January 21, 2021 at 03:25PM
没有评论:
发表评论