A Repasky

A Repasky

  • NA
  • 231
  • 183.1k

Lamda expression to remove filename

Nov 30 2011 11:59 AM
I added the 3rd line below to remove the one filename from the list.



Do I have to combine the Sort and RemoveAll? Anyway it does not seem to be working.


Arep
 

         DirectoryInfo directoryInfo = new DirectoryInfo(@"E:\Data\KidsCert\FileNet\");
         List<FileInfo> list = directoryInfo.GetFiles().ToList();
         list.RemoveAll(n => n.Name == "CHIPHIPAA.csv");
         list.Sort((a, b) => string.Compare(a.Name, b.Name));
         foreach (var item in list)


.......etc.



Answers (2)