Interface IPurePath
Represents an immutable and pure file system path that is independent of the actual file system.
public interface IPurePath
- Extension Methods
Properties
Name
Gets the name of the path component, or null if unavailable.
string? Name { get; }
Property Value
ParentPure
Gets the parent path.
IPurePath ParentPure { get; }
Property Value
Exceptions
- InvalidOperationException
Thrown when the path has no parent.
Path
Gets the string representation of the path.
string Path { get; }
Property Value
Platform
Gets the platform of the path (e.g., Unix, Windows).
PathPlatform Platform { get; }
Property Value
Type
Gets the type of the path (e.g., file, directory).
PathType Type { get; }
Property Value
Methods
Append(IPurePath)
Appends another pure path to the current path.
IPurePath Append(IPurePath right)
Parameters
rightIPurePathThe path to append.
Returns
Append(string)
Appends a string segment to the current path.
IPurePath Append(string right)
Parameters
rightstringThe segment to append.
Returns
TryGetName(out string?)
Attempts to retrieve the name of the path component (e.g., filename or directory name).
bool TryGetName(out string? fileName)
Parameters
fileNamestringWhen this method returns, contains the name of the path component if available; otherwise,
null.
Returns
- bool
trueif the name was successfully retrieved; otherwise,false.
TryGetParentPure(out IPurePath?)
Attempts to retrieve the parent path.
bool TryGetParentPure(out IPurePath? parent)
Parameters
parentIPurePathWhen this method returns, contains the parent path if available; otherwise,
null.
Returns
- bool
trueif the parent path was successfully retrieved; otherwise,false.
Operators
operator /(IPurePath, IPurePath)
Concatenates two pure paths using the division operator.
public static IPurePath operator /(IPurePath left, IPurePath right)
Parameters
Returns
operator /(IPurePath, string)
Concatenates a path with a string segment using the division operator.
public static IPurePath operator /(IPurePath left, string right)