LINQ specifically does not have a "mutate all" method because it's trying to be kind of functional. If you absolutely must have this you can define your own ForEach
extension method that takes an Action
and runs it on all items.
public static void ForEachAbomination<T>(this IEnumerable<T> source, Action<T> action) {
foreach (T item in source)
action(item);
}
This allows you to do
someObjects.ForEachAbomination(i => { i.Arm = "Manly"; });
But honestly, I think a foreach
is more readable if you're mutating things.