How does a logical & work on two bytes in C#?
<p>I recently had a test question:</p>

<pre><code>byte a,b,c;
a = 190;
b = 4;
c = (byte)(a &amp; b);
</code></pre>

<p>What is the value of c?</p>

<p>I have never used a logical operand in this manner, what's going on here? Stepping through this, the answer is 4, but why?</p>

<p>Also, where would this come up in the real world? I would argue that using logical operands in this manner, with a cast, is just bad practice, but I could be wrong.</p>
