Table of Contents

Struct DirectoryPath

Namespace
Garyon.Objects.IO
Assembly
Garyon.dll

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

directoryInfo DirectoryInfo

The 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

Path string

The 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

DirectoryInfo

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

DirectoryPath

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

string

Methods

File(string)

Returns a FilePath by combining this directory path with a file name.

public FilePath File(string fileName)

Parameters

fileName string

The file name to combine with Path.

Returns

FilePath

Operators

implicit operator DirectoryPath(DirectoryInfo)

Converts a DirectoryInfo instance to a DirectoryPath instance.

public static implicit operator DirectoryPath(DirectoryInfo path)

Parameters

path DirectoryInfo

Returns

DirectoryPath

implicit operator DirectoryPath(string)

Converts a path string to a DirectoryPath instance.

public static implicit operator DirectoryPath(string path)

Parameters

path string

Returns

DirectoryPath