title: How to Update a generic list passed by reference to a method?
body: <p>I have a generic list of messages, which I pass to a method by reference. 
  The method uses one of the messages from the list and updates the message.</p>
  
  <p>How do I get this message updated with a new text, when passing the entire list by reference?</p>
  
  <p>e.g. </p>
  
  <pre><code>private int RetrieveAndProcessQueueEntityRows(
          string sEntityCode,
          string sMessageFIDs,
          int iNumberToFetch,
          ref List&lt;Entity&gt; oMessageList) {
  
  ////......
  
  Message currMessage = null;
  
  foreach (Message oMessage in oMessageList) {
       if (oMessage.Message_UID == oPatientInfoEntityCurrent.MessageFID) {
          currMessage = oMessage;
          break;
       }
  }
  </code></pre>
  
  <p>So now I can use the currMessage object to do the required updates. But how do I update the <code>List&lt;Entity&gt; oMessageList</code> with the <code>currMessage</code>?</p>
  
  <p>Thanks for all your help!
   - Lakus</p>