Can someone point out the differences between the operators C#and their similar extension methods? for example: foreachcompared to .ForEach(extension method).
C#
foreach
.ForEach
If there is any difference , what are they? Security? Efficiency? Which one is better to use? Which one is safer? and etc.
And if there are no differences, then why write them?
I thought and looked for this question a little, if mine did not find an answer. thanks in advanced condition.
. .ForEach.
/ . "" , .ForEach foreach, . , , , (: ). , , , . , , , - .
, .ForEach , - , "" . foreach .
, : ForEach IEnumerable?
. , , , . , .
, . :foreach (Foo foo in foos) { foo; }:foos.ForEach((Foo foo) = > {, foo;});. , , .
, . :
foreach (Foo foo in foos) { foo; }
:
foos.ForEach((Foo foo) = > {, foo;});
. , , .
.ForEach Parallel.ForEach. .ForEach / . , , .
Parallel.ForEach
, Parallel.ForEach, foreach .