var n = 0; collection.ForEach(x=>x.Name = "Effect {0}".FormatWith(++n));
These are the simple extension methods that I returned in 3.5:
public static void ForEach<T>(this IEnumerable<T> collection, Action<T> lambda) { foreach(var element in collection) lambda(element); } public static string FormatWith(this string base, params object[] args) { return String.Format(base, args); }
source share