Jul
15th | 2008

How to Search the File System Using LINQ Queries

Posted by Amit |
Filed under .Net, C# |

Here is something neat I found out.

Say you are writing an application and one of the requirements is to allow File System search. You could always start using loops and such. I thought to myself why not do it in LINQ? I played around with it and in fact it is not so hard.

Lets see how it is done. Here is method that allows finding a specific file name in side a directory.

   1: private List SearchFilesByName(string DirectoryPath, string FileName) 
   2: { 
   3:     return (from file in new DirectoryInfo(DirectoryPath).GetFiles() 
   4:             where file.Name == FileName select file).ToList(); 
   5: }

Basically we Query the FileInfo[] which is returned from the GetFiles() method and compare the file name.


Continue Reading...
Apr
24th | 2008

A Great XPath Query Tool

Posted by Shahar Y |
Filed under .Net, C#, Utilities |

XPath is a language for addressing parts of an XML document, for those who are not familiar with this language - here are the W3C specifications and here is the W3schools tutorial. Now that we know XPath, lets get to the point of that post which is - Visual XPath.

This is a free graphical XPath [...]


Continue Reading...
Mar
9th | 2008

Very Good Linq Editor

Posted by Amit |
Filed under .Net |

This one is for all you guys who are just starting to use LINQ and have no idea how to make those queries work.
I have tried it and i am glad to say that it is very friendly and usable especially if you have no experience with Linq
Linqpad is a very user friendly LINQ editor [...]


Continue Reading...

Search Dev102