c# edit element in list
var index = list.FindIndex(c => c.Number == someTextBox.Text);
list[index] = new SomeClass(...);
c# edit element in list
var index = list.FindIndex(c => c.Number == someTextBox.Text);
list[index] = new SomeClass(...);
update value in list c#
var result = list.Select(i =>
{
if (i.Name == "height") i.Value = 30;
return i;
}).ToList();
update value in list c#
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();
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us