C# LIST.FOREACH +lambda example

never found a really simple example, see this:
List<string> parts = new List<string>();
parts.ForEach(delegate (string p) {
     Console.WriteLine(p);    });
since in lambda () is delegate() so
List<DateTime> dates = new List<DateTime>(); // just to show that T doesnt matter
parts.ForEach((DateTime d) =>
{
      Console.WriteLine(d);
});
PLUS u can do the remarkable list.Remove(d)! unlike foreach

Comments

Popular posts from this blog

OverTheWire[.com] Natas Walkthrough - JUST HINT, NO SPOILERS

Asp.Net Ending Response options, Response.End() vs CompleteRequest()

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem