Translating Query-Based to Method-Based Not Working


I would expect the following lines of code to result in a method-based translation when clicking on the lambda button in LINQPad; however, I do not see anything. Is there a reason for this? I am running the Premium version of LP on Windows 8.

var files = Directory.GetFiles(@C:\Windows, "*.*", SearchOption.TopDirectoryOnly);

var query = from f in files
//where f.Contains("bootstat")
select new { FileName = f };

foreach (var s in query)

Thanks in advance!



  • Add .AsQueryable() to your query so that it's expression-tree-based rather than delegate-based:
    var query = from f in files.AsQueryable()
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!