title: Can't change value in foreach from IEnumerable<Model>
body: <p>How to change value of an object in <code>foreach</code> from <code>IEnumerable&lt;Model&gt;</code>.</p>
  
  <p>Code:</p>
  
  <pre><code>public IEnumerable&lt;Model&gt; ListDaftarPjsp()
  {
      IEnumerable&lt;Model&gt; list = from x in db.PJSPEvaluation
                                select new Model
                                {
                                    foo = x.Foo,
                                    bar = x.Bar               
                                };
      foreach (Model item in list) {
          item.condition = "example";
      }
      return list;
  }
  
  public class Model{
      public string foo{ get; set; }
      public string bar { get; set; }
      public string condition{ get; set; }
  }
  </code></pre>
  
  <p>I already create <code>Model</code>. Then I am looping result using foreach, then set it. But the Return  for <code>condition</code>still not changing? how to set condition inside foreach then return it for result </p>