📅  最后修改于: 2022-03-11 14:48:47.346000             🧑  作者: Mango
myList.ForEach(p => myFunc(p));
//or
public static void ForEach(this IEnumerable source, Action 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(() => {
//Do something here...
Console.WriteLine(x);
return x.ToUpper();
}
)).Select(t => t.Invoke()).ToArray();
//or
var functions = (new string[] { "d", "f" }).
Select(x => new Func(() => {
//Do something here...
Console.WriteLine(x);
return x.ToUpper();
}));
string[] items = functions.Select(t => t.Invoke()).ToArray();