lambda C# select any perform action list call function
myList.ForEach(p => myFunc(p));
//or
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
{
foreach(T item in source)
action(item);
}
Which means you can now do:
myList.Where( ... ).ForEach( ... );
//or
string[] items = (new string[] { "d", "f" }).
Select(x => new Func<string>(() => {
//Do something here...
Console.WriteLine(x);
return x.ToUpper();
}
)).Select(t => t.Invoke()).ToArray<string>();
//or
var functions = (new string[] { "d", "f" }).
Select(x => new Func<string>(() => {
//Do something here...
Console.WriteLine(x);
return x.ToUpper();
}));
string[] items = functions.Select(t => t.Invoke()).ToArray<string>();