I have a list of products from the database and from this list, I used LINQ and a list of phones Returned class as a form.
Listings & gt; Products & gt; Products = new list & lt; Products & gt; New product {ID = 1, name = "alcohol"} has expired, new product {id = 2, name = "phone", expired = false}, new product {id = 2, name = " Phone "expired = false}, new product {id = 3, name =" computer ", expired = false}, new product {id = 4, name =" president ", time expired}}} ; In the products from Var results = i Where (o = & gt; o.Name == "phone") select new phones {id = i.id, phone = i.Name, isChild = i.Expired}; // ischild property foreach update (var item in result) {item.ischild = true; } Public category phones {get public id ID {. Set; } Public string phone {get; Set; } The public is Bull Children {Go; Set; }}
I used to update the list of phones using the foreach loop. But the problem is that when I checked the result variable it did not update the said item.
No comments:
Post a Comment