title: c# Update item in list
body: <p>I have the following:</p>
  
  <pre><code>public class Item
  {
     public Item()
     {
  
     }
  
     public string Name {get; set;}
  }
  
  
  public static class Extension
  {
      public static Item Modify(this Item itm)
      {
          itm.Name = "Changed";
  
          return itm;
      }
  }
  </code></pre>
  
  <p>and then in my code I instantiate a <code>List&lt;Item&gt;</code> and add 10 items to it.</p>
  
  <pre><code>List&lt;Item&gt; items = new List&lt;Item&gt;();  // contains 10 items
  .....
  </code></pre>
  
  <p>If now I want to iterate my list and for each item I call the extension method and modify it's name property, how do I update the item in <code>items</code> list?</p>
  
  <pre><code>foreach (Item itm in items)
  {
      Item changedItem = itm.Modify();
      // update item in items list
  }
  </code></pre>