Instead of doing this horrible loop which does achieve the desired result :
foreach (var mealsViewModel in mealsListCollection) { foreach (var VARIABLE in mealsViewModel.Items) { foreach (var d in VARIABLE.ArticlesAvailable) { d.ArticleQty = 0; } } } I'm trying to achieve the same result but with this linQ statement :
mealsListCollection.ForEach(u => u.Items.Select(o => o.ArticlesAvailable.Select(c => { c.ArticleQty = 0; return c; }))); But the linQ statement does not reset ArticleQty to zero
What I am doing wrong? and why ?
Select()method does not iterate over collectionmealsListCollection.ForEach(u => u.Items.ForEach(i => i.ArticlesAvailable.ForEach(c => c.ArticleQty = 0)))ForEach- github.com/morelinq/MoreLINQ/blob/master/MoreLinq/ForEach.cs - instead ofSelect.