How to display list items on console window in C#
I have a List which contains all databases names. I have to dispaly the items contained in that list in the Console (using Console.WriteLine() ). How can I achieve this? Svish Actually you can do it pretty simple, since the list have a ForEach method and since you can pass in Console.WriteLine as a method group. The compiler will then use an implicit conversion to convert the method group to, in this case, an Action<int> and pick the most specific method from the group, in this case Console.WriteLine(int) : var list = new List<int>(Enumerable.Range(0, 50)); list.ForEach(Console.WriteLine);