[DataContractAttribute(Namespace = "http://schemas.quine.no/core/v3_0.xsd")]
public struct PathComponents : IEnumerable<string>,
IEnumerable, IEquatable<PathComponents>, IContentAddressable
If IsAbsolute is true, the 0th component of the path is the "root component", otherwise the whole path is relative. Supports mixed-separator paths on input; the separator is internally replaced with SeparatorChar . Correctly parses Windows and Unix paths on both platforms.
A path MUST not contain empty components, with the exception of Unix absolute paths where the root component is an empty string. (In string form, this means that a path ending with / or having // in the middle is invalid.) Supported path patterns are the following:
PathFormatException is thrown when invalid paths are given or internal variants violated.
This class is needed because Path class behaves differently on different platforms.
IsEmpty | True if this is an empty PathComponents object (Empty). NB! This will return true also for a default instance. |
IsNull | True only for a default instance (i.e., Empty instance will return false). |
Item | Indexer. |
Length | Number of components in this path. |
NativeString | Returns a string representation of this using the platform's native character separator. |
Append | Appends components to the end of this. |
Equals(Object) | Indicates whether this instance and a specified object are equal. (Overrides ValueTypeEquals(Object)) |
Equals(PathComponents) | Two instances are equal if they are component-wise equal AND both have the same value of IsAbsolute property. |
GetEnumerator | Returns an enumerator that iterates through the collection. |
GetHashCode | Returns the hash code for this instance. (Overrides ValueTypeGetHashCode) |
IsPrefixOf | Check whether this path is a prefix of other. A path is a prefix of itself. |
IsSuffixOf | Check whether this path is a suffix of other. A path is a suffix of itself. |
Join | Returns the concatenation of the given components. Empty components, except the 1st one, are removed. |
Make | Creates an instance. |
Prepend | Returns new object with the given components prepended to this object. |
RemovePrefix(Int32) | Remove the given number of components from this path. |
RemovePrefix(PathComponents) | Remove a path prefix from this path. |
RemoveSuffix(Int32) | Remove the given number of components from this path. |
RemoveSuffix(PathComponents) | Remove a path suffix from this path |
ReplaceComponent | Replaces the component at componentIndex with newValue |
Equality(PathComponents, PathComponents) | Implemented using Equals(PathComponents). |
Inequality(PathComponents, PathComponents) | Implemented using Equals(PathComponents). |
Empty | Unique instance of an empty PathComponents object: it has zero components and is not absolute. An empty PathComponents object cannot be instantiated in any other way. NB! default instance is regrettably NOT equal to Empty. |
ForbiddenChars | A set of characters that must not occur in either native file names or path names in a cross-platform application. '\' is also included; it may possibly be a valid filename char on unix, but we can't allow it in xplatform app. |
IsAbsolute | True if this is an absolute path. |
IsWindows | True if we're running on Windows. |
NormalizedString | Normalized string for serialization; uses '/' as separator character. |
SeparatorChar | The / character is internally used to separate individual components. |