Working with paths
System.IO.Path
is a static class that performs operations on strings, representing the path of a filesystem object (a file or a directory). None of the class methods verify whether the string represents the path of a valid file or directory. However, members that accept an input path verify that the path is well formed; otherwise, they throw an exception. This class can handle paths for different platforms. The format of a path such as the presence of a root element or the path separator is platform-dependent and is determined by the platform that the application is running on.
A path can be relative or absolute. An absolute path is one that fully specifies the location. On the other hand, a relative path is a partial location determined by the current location, which can be retrieved with a call to the Directory.GetCurrentDirector()
method.
All the members of the Path
class are static. The most important ones are listed in the following table: