2
Answers

Lamda expression to remove filename

A Repasky

A Repasky

12y
1.6k
1
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)