Don't do as Johnny don't does.

Originally from dotnet-snippets this lovely piece of code shows the power and danger of LINQ in one go:

var files = from file in new DirectoryInfo(@"C:\").GetFiles()
            where file.Name.StartsWith("_")
            select file;

Sure, you could use that piece of code to search for files… but don't.

(Although surely it can't be long before someone adds deferred execution support for a filesystem? Maybe it's coming in WinFS Forever?)

Posted on Thursday, October 02, 2008 8:37 PM |

Like this? Share it!

Post a comment
Please add 5 and 6 and type the answer here:
Remember me?
Ensure the word in this box says 'orange':