LINQ


About LINQ

Applies a SQL like syntax to .NET collections

 

LINQ Code Snippets

How many root folders contain a space:

                var lvInfo = new System.IO.DirectoryInfo("C:\\");

                var lvCollection = lvInfo.GetDirectories();
                var lvItems = from n in lvCollection where (0 < n.Name.IndexOf(' ')) select n.FullName;
                Console.WriteLine("{0} items contain a space", lvItems.Count());