1: var names = Directory.GetFiles(@"c:\Program Files").ToList();
2: names.ForEach(n => Console.WriteLine(n));
The Method Group shorthand is usually found in places where you take the following code
myButton.Click += new EventHandler(myButton_Click);
and replace it with this.
myButton.Click += myButton_Click;
The C# compiler can infer the usage of the EventHandler class, giving you cleaner, less noisy code.
1: var names = Directory.GetFiles(@"c:\ProgramFiles").ToList();
2: names.ForEach(Console.WriteLine);










