Linq-a-fi your file system by creating your own DSL
Posted by: Williams .Net Zone,
on 19 Oct 2008 |
View original | Bookmarked: 0 time(s)
Sample usage: Console.WriteLine("\nGet number of files and total size under a dir.");long totSize = 0;long totFiles = 0;var q = (from f in new LFileInfo(@"c:\temp").Children(true) let x = totSize += f.Length let y = totFiles++ select f); Console.WriteLine("Total Size:{0:N} Total Files: {1}", totSize, totFiles); // LFileInfo. Wraps a FileSystemInfo object to allow us to more simply "linq-a-fi" directory operations.using System;using System.Collections.Generic;using...