var item = TextPool.FirstOrDefault(o => o.Name == "test");
if (item != null)
item.value = "Value";
foreach (var mc in list.Where(x => x.Name == "height"))
mc.Value = 30;
var result = list.Select(i =>
{
if (i.Name == "height") i.Value = 30;
return i;
}).ToList();
list.Where(w => w.Name == "height").ToList().ForEach(s => s.Value = 30);
list = list.Where(c=>c.Name == "height")
.Select( new t(){Name = c.Name, Value = 30})
.Union(list.Where(c=> c.Name != "height"))
.ToList();
public static IEnumerable<MyClass> SetHeights(
this IEnumerable<MyClass> source, int value)
{
foreach (var item in source)
{
if (item.Name == "height")
{
item.Value = value;
}
yield return item;
}
}
var result = list.SetHeights(30).ToList();