title: conditional Updating a list using LINQ
body: <p>I had a list</p>
  
  <pre><code>List&lt;Myclass&gt; li = new List&lt;Myclass&gt;();
  </code></pre>
  
  <p>where Myclass is</p>
  
  <pre><code>class Myclass
  {
  public string name {get;set;}
  public decimal age {get;set;}
  }
  </code></pre>
  
  <p>items in li looks like</p>
  
  <p><img src="https://i.stack.imgur.com/mFhU8.png" alt="enter image description here"></p>
  
  <pre><code> i want to update `li` according to name but with `LINQ` like
  
  li.where(w=&gt; w.name = "di") = li.Where(w =&gt; w.name =="di").select(s =&gt; {s.age = 10;return s;}).Tolist();
  li.where(w=&gt; w.name = "marks") = li.Where(w =&gt; w.name =="marks").select(s =&gt; {s.age = 20;return s;}).Tolist();
  li.where(w=&gt; w.name = "grade") = li.Where(w =&gt; w.name =="grade").select(s =&gt; {s.age = 10;return s;}).Tolist();
  </code></pre>
  
  <p>and want result which looks like this</p>
  
  <p><img src="https://i.stack.imgur.com/1IRoT.png" alt="enter image description here"></p>
  
  <p>my code gives error can you  please tell how i do this</p>