I had a list
List<Myclass> li = new List<Myclass>();
where Myclass is
class Myclass
{
public string name {get;set;}
public decimal age {get;set;}
}
items in li looks like
i want to update `li` according to name but with `LINQ` like
li.where(w=> w.name = "di") = li.Where(w => w.name =="di").select(s => {s.age = 10;return s;}).Tolist();
li.where(w=> w.name = "marks") = li.Where(w => w.name =="marks").select(s => {s.age = 20;return s;}).Tolist();
li.where(w=> w.name = "grade") = li.Where(w => w.name =="grade").select(s => {s.age = 10;return s;}).Tolist();
and want result which looks like this
my code gives error can you please tell how i do this