title: How may I return a const reference to an object from a method?
body: <pre class="lang-cs prettyprint-override"><code>public Item getItem(ulong itemId)
  {
      Item item = items[itemId]
      return item;
  }
  </code></pre>
  
  <p>Now the problem is: the callee of <code>getItem</code> must be able to retrieve information that <code>item</code> holds; but not modify it.</p>
  
  <p>Sorry, but I know C++ better than C#... I'm afraid I must fall back to C++ for a teeny tiny while just to make myself clear what I'm trying to achieve... So this is what I'd do in C++ in this situation:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>const Item&amp; getItem(unsigned long itemId)
  {
      const Item&amp; item = items[itemId];
      return item;
  }
  </code></pre>
  
  <p>Very well - now whoever called <code>getItem</code> may call getters on <code>item</code>, but not setters.</p>
  
  <p>I need to achieve a similar result in C#... is it possible?</p>