LINQ Example 1- How to use where condition or keyword in LINQ

LINQ Example 1: How to use where condition or keyword in LINQ

Using this example we will learn to how to use where condition in the LINQ. 

Example: 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LINQ_Tutorial_1_Where_condition
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] values = {1,2,3,4,5,6,7,8,9,0,1 };

            var queredgtfive = from v in values
                               where v > 5
                               select v;
            Console.WriteLine("Quered values");

                foreach(var i in queredgtfive){
                    Console.WriteLine(i);
                }

            Console.Read();
                    
        }
    }
}

OUTPUT :
Quered values
6
7
8
9


Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar