title: C# Left Shift Operator
body: <p>There's a statement a co-worker of mine wrote which I don't completely understand. Unfortunately he's not available right now, so here it is (with modified names, we're working on a game in Unity).</p>
  
  <pre><code>private readonly int FRUIT_LAYERS =
            (1 &lt;&lt; LayerMask.NameToLayer("Apple"))
          | (1 &lt;&lt; LayerMask.NameToLayer("Banana"));
  </code></pre>
  
  <p>NameToLayer takes a string and returns an integer. I've always seen left shift operators used with the constant integer on the right side, not the left, and all the examples I'm finding via Google follow that approach. In this case, I think he's pushing Apple and Banana onto the same relative layer (which I'll use later for filtering). In the future there would be more "fruits" to filter by. Any brilliant stackoverflowers who can give me an explanation of what's happening on those lines?</p>