The .Net framework uses simple
strings to represent paths in the file system. For example
So do we in our code.
The problem is that we never know for sure whether it is an absolute or relative path. Or if it is even a path with a shortcut like
We assign strings to strings and by making a wrong assumption, we introduced a defect.
The file path classes of Appccelerate help you to make your code cleaner by using strongly typed variables.
AbsolutePath represents an absolute path - a rooted path.
It can be a file or folder path.
When instantiating an absolute path
- with constructor:
- with implicit cast:
An absolute path can be converted to a
AbsoluteFolderPath by using one of following methods on the
Absolute File Path
Represents an absolute file path.
It is only valid when the path is an absolute path and contains a filename.
Absolute Folder Path
Represents an absolute folder path.
Represents a path with a shortcut like
Checks whether there is an even number of
% characters in the path.
Equality, HashCode, == and !=
All Appccelerate paths support the methods
HashCode and the operators
All Appccelerate paths can implicitly be casted to and from string.
That means you can assign paths from strings or pass paths to methods using strings (like the one of the .Net framework).
Different types of paths cannot be assigned to each other. To prevent for example assigning a folder path to a file path.