How to add a condition here if f != null ?

 var files = filesA.Select((f) => new FileInfo(f)) 

    1 answer 1

    Use the Where method to filter. Like this:

     var files = filesA.Where(f => f != null).Select(f => new FileInfo(f));