A good example of the power of Linq:
Directory.EnumerateFiles(@"S\Source\", "*.*proj", SearchOption.AllDirectories)
.SelectMany(file => File.ReadAllLines(file).Select((text,n)=> new {text,lineNumber=n+1,file}))
.Where(line => Regex.IsMatch(line.text,@"SccProjectName"))
.Where(line => !Regex.IsMatch(line.text,@"SAK"))
.Dump("Should be set to SAK")
No comments:
Post a Comment