.Net > Intermediate

Is it possible to apply Linq query on File.ReadAllLines method?

For example, getting all lines which have "first" word:

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

class Program
    static void Main()

        List<string> fileLineCount = (from line in File.ReadAllLines("../../file.txt")
                                      where line.Contains("first")
                                      select line).ToList<string>();


Answers :
Time Left
Question Number : /20
Please do not press back or refresh button during this test.



Next Question