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) =>
PLUS u can do the remarkable list.Remove(d)! unlike foreach


Popular posts from this blog

c# Service Play Sound with NAudio example by Moshe

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

JS/JQ simulate Enter event