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);
            
        }
post comment
     
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts