Why are there no ||= or &&= operators in C#?
问题 We have equivalent assignment operators for all Logical operators, Shift operators, Additive operators and all Multiplicative operators. Why did the logical operators get left out? Is there a good technical reason why it is hard? 回答1: Why did the logical operators get left out? Is there a good technical reason why it is hard? They didn't . You can do &= or |= or ^= if you want. bool b1 = false; bool b2 = true; b1 |= b2; // means b1 = b1 | b2 The || and && operators do not have a compound form