I saw a couple of questions here about the diference between && and & operators in C#, but I am still confused how it is used, and what outcome results in different situations. For example I just glimpsed the following code in a project
bMyBoolean = Convert.ToBoolean(nMyInt & 1);
bMyBoolean = Convert.ToBoolean(nMyInt & 2);
When it will result 0 and when >0? What is the logic behind this operator? What are the diferences between the operator '|'?
bMyBoolean = Convert.ToBoolean(nMyInt | 1);
bMyBoolean = Convert.ToBoolean(nMyInt | 2);
Can we use the &&, || operators and get the same results (possibly with different code)?