Performs the specified action on each element of the List<T>.
Assembly: mscorlib (in mscorlib.dll)
This method is an O(n) operation, where n is Count.
Modifying the underlying collection in the body of the Action<T> delegate is not supported and causes undefined behavior.
The following example demonstrates the use of the Action<T> delegate to print the contents of a List<T> object. In this example the Print method is used to display the contents of the list to the console.
In addition to displaying the contents using the Print method, the C# example demonstrates the use of anonymous methods to display the results to the console.