Use a query expression as a for loop - CSharp Collection

CSharp examples for Collection:Enumerable

Description

Use a query expression as a for loop

Demo Code



using System;/*from   w w w  .j a  va 2  s .c o m*/
using System.Collections.Generic;
using System.Linq;
using System.IO;
class Program
{
    static void Main(string[] args)
    {

        Enumerable.Range(1, 10).ToList<int>().ForEach(n => Console.WriteLine("n = {0}", n));


    }
}

Result


Related Tutorials