C# LINQ to query a directory

Posted on Posted in C#, LINQ, Programming

I like introduce the easiness of using LINQ with C# on query of a directory, and how short the code could be. Before we will need to long line of code to complete this task, but LINQ came along in C# 3.0, has short and simplify the process alot. Also when querying the directory, you can even dig out only the name of the file, or the full path if you like. Here let have a look at the code;