I have 3 foreach function's, writing the list l of type / class Person to Console
foreach(Person p in l)
{
Console.WriteLine(p.first);
Console.WriteLine(p.last);
}
l.ForEach(p =>
{
Console.WriteLine(p.first);
Console.WriteLine(p.last);
});
Parallel.ForEach(l, p =>
{
Console.WriteLine(p.first);
Console.WriteLine(p.last);
});
They are all doing the same except that Parallel is working with threading i guess. What should i use when?