Hi
Don't know about 'fastest' as I have not tried multiple methods, but I would have tried something like this.
Dim forbidden() As String = {"CON", "PRN", "AUX", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}
Dim filenames() As String = {"lpt5", "com", "com2", "lpt", "aux"}
Dim hold As String = String.Empty
For Each filename As String In filenames
If forbidden.Contains(filename.ToUpper) Then
hold &= filename & " "
End If
Next
MessageBox.Show("Forbidden filenames" & vbCrLf & hold)