I would like to know how to determine whether string is valid file path.
The file path may or may not exist.
Here are some things you might use:
Path.IsPathRooted to see if it's not a relative path and then use the drives from Environment.GetLogicalDrives() to see if your path contains one of the valid drives.Path.GetInvalidFileNameChars() and Path.GetInvalidPathChars() which don't overlap completely. You can also use Path.GetDirectoryName(path) and Path.GetFileName(fileName) with your input name, which will throw an exception if The path parameter contains invalid characters, is empty, or contains only white spaces.