.Net > Random > Beginner Next/Skip this question

Can we use Linq query on a List object?

for example

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        List<int> numbers = new List<int> { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };

        var lowNums =
            from n in numbers
            where n < 5
            select n;

        foreach (var x in lowNums)
        {
            Console.Write(x);
        }
        Console.ReadLine();
    }
}
Answers :
Explaination :
social share share on facebook share on twitter share on google plus share on linkedin
Add Comments :

Login

Register

Next Question