Imports System
Imports System.IO
Module PathExample
Sub Main()
' Get a list of invalid path characters.
Dim invalidPathChars As Char() = Path.GetInvalidPathChars()
Console.WriteLine("The following characters are invalid ina path:")
' Display each invalid character to the console.
Dim invalidPChar As Char
For Each invalidPChar In invalidPathChars
Console.WriteLine(invalidPChar)
Next invalidPChar
' Get a list of invalid file characters.
Dim invalidFileChars As Char() = Path.GetInvalidFileNameChars()
Console.WriteLine("The following characters are invalid ina path:")
' Display each invalid character to the console.
Dim invalidFChar As Char
For Each invalidFChar In invalidFileChars
Console.WriteLine(invalidFChar)
Next invalidFChar
Console.ReadLine()
End Sub
End Module
' Note that while this code attempts to display a list of all invalid
' characters in paths and filenames, not all of the characters are
' within the displayable set of characters. Because the list of invalid
' characters can vary, based on the system, output for this code can vary.