Struct DirectoryPath
Represents a directory path wrapper that provides lightweight, non-I/O path manipulation helpers.
public readonly record struct DirectoryPath : IFileSystemPath, IEquatable<DirectoryPath>
- Implements
- Inherited Members
- Extension Methods
Constructors
DirectoryPath(DirectoryInfo)
Initializes a new instance of DirectoryPath from a DirectoryInfo instance.
public DirectoryPath(DirectoryInfo directoryInfo)
Parameters
directoryInfoDirectoryInfoThe DirectoryInfo whose FullName will be stored.
DirectoryPath(string)
Represents a directory path wrapper that provides lightweight, non-I/O path manipulation helpers.
public DirectoryPath(string Path)
Parameters
PathstringThe directory path. This type does not validate existence or interact with the file system; it only stores and manipulates the path string.
Properties
DirectoryInfo
Gets a DirectoryInfo wrapper for this path.
public DirectoryInfo DirectoryInfo { get; }
Property Value
Remarks
Creating a DirectoryInfo does not access the file system. Accessing certain members of the returned instance may.
Parent
Gets the parent directory of this directory path, or default if the path has no parent.
public DirectoryPath Parent { get; }
Property Value
Path
The directory path. This type does not validate existence or interact with the file system; it only stores and manipulates the path string.
public string Path { get; init; }
Property Value
Methods
File(string)
Returns a FilePath by combining this directory path with a file name.
public FilePath File(string fileName)
Parameters
Returns
Operators
implicit operator DirectoryPath(DirectoryInfo)
Converts a DirectoryInfo instance to a DirectoryPath instance.
public static implicit operator DirectoryPath(DirectoryInfo path)
Parameters
pathDirectoryInfo
Returns
implicit operator DirectoryPath(string)
Converts a path string to a DirectoryPath instance.
public static implicit operator DirectoryPath(string path)
Parameters
pathstring