Blog

A simple example of LINQ

Posted by Mahak Gupta Blogs | LINQ Sep 19, 2011
Here we take a simple example of LINQ.
Here we take a simple example of LINQ. We just compare a number with a number of digits:

 int[] digits = { 5, 4, 1, 7, 9, 8, 6, 7, 4, 5 };

        var num =
            from n in digits
            where n >= 6
            select n;


        Console.WriteLine("Numbers < 5:");
        
        foreach (var x in num)
        {
            Response.Write(x);
            
        }
COMMENT USING
PREMIUM SPONSORS
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.