A clear, layman's explanation of the difference between | and || in c#?
问题 Ok, so I've read about this a number of times, but I'm yet to hear a clear, easy to understand (and memorable) way to learn the difference between: if (x | y) and if (x || y) ..within the context of C#. Can anyone please help me learn this basic truth, and how C# specifically, treats them differently (because they seem to do the same thing). If the difference a given piece of code has between them is irrelevant, which should I default to as a best-practise? 回答1: || is the logical-or operator.