6
I’m trying to implement the example of this page, but VS2015 (.NET 4.5) says the method ForEach()
there is no
class Program
{
static void Main()
{
List<String> names = new List<String>();
names.Add("Bruce");
names.Add("Alfred");
names.Add("Tim");
names.Add("Richard");
// Display the contents of the list using the Print method.
names.ForEach(Print);
// The following demonstrates the anonymous method feature of C#
// to display the contents of the list to the console.
names.ForEach(delegate(String name)
{
Console.WriteLine(name);
});
}
private static void Print(string s)
{
Console.WriteLine(s);
}
}
I left the method Print
without implementation, obviously the same makes no difference.
That must be it,
Console Application
works normally, already in thePortable Application
nay.– rubStackOverflow