Interface IDirectoryPath
Represents a path to a directory on file system.
public interface IDirectoryPath : IPath
- Inherited Members
- Extension Methods
Remarks
The path can be relative or absolute. The extension method ToDirectoryPath(string) can be called to create a new IDirectoryPath object from a string.
Property (1)
DirectoryName
Gets a string representing the directory name.
string DirectoryName { get; }
Property Value
- string
The directory name.
Remarks
If the directory is a root volume, like "C:", returns an empty string.
Methods (8)
GetBrotherDirectoryWithName(string)
Returns a new directory path representing a directory with name directoryName, located in the parent's directory of this directory.
IDirectoryPath GetBrotherDirectoryWithName(string directoryName)
Parameters
directoryNamestringThe brother directory name.
Returns
Remarks
This directory nor the returned directory need to exist for this operation to complete properly.
Exceptions
- InvalidOperationException
This directory path doesn't have a parent directory.
GetBrotherFileWithName(string)
Returns a new file path representing a file with name fileName, located in the parent's directory of this directory.
IFilePath GetBrotherFileWithName(string fileName)
Parameters
fileNamestringThe brother file name.
Returns
Remarks
This directory nor the returned file need to exist for this operation to complete properly.
Exceptions
- InvalidOperationException
This directory path doesn't have a parent directory.
GetChildDirectoryWithName(string)
Returns a new directory path representing a directory with name directoryName, located in this directory.
IDirectoryPath GetChildDirectoryWithName(string directoryName)
Parameters
directoryNamestringThe child directory name.
Returns
Remarks
This directory nor the returned directory need to exist for this operation to complete properly.
Exceptions
- InvalidOperationException
This directory path doesn't have a parent directory.
GetChildFileWithName(string)
Returns a new file path representing a file with name fileName, located in this directory.
IFilePath GetChildFileWithName(string fileName)
Parameters
fileNamestringThe child file name.
Returns
Remarks
This directory nor the returned file need to exist for this operation to complete properly.
TryGetBrotherDirectoryWithName(string, out IDirectoryPath, out string)
Returns true if directoryName doesn't contain forbidden character in path.
bool TryGetBrotherDirectoryWithName(string directoryName, out IDirectoryPath directoryPath, out string failureReason)
Parameters
directoryNamestringThe brother directory name.
directoryPathIDirectoryPathThe directory path obtained.
failureReasonstringThe explanation in case this call returns false.
Returns
TryGetBrotherFileWithName(string, out IFilePath, out string)
Returns true if fileName doesn't contain forbidden character in path.
bool TryGetBrotherFileWithName(string fileName, out IFilePath filePath, out string failureReason)
Parameters
fileNamestringThe brother file name.
filePathIFilePathThe file path obtained.
failureReasonstringThe explanation in case this call returns false.
Returns
TryGetChildDirectoryWithName(string, out IDirectoryPath, out string)
Returns true if directoryName doesn't contain forbidden character in path.
bool TryGetChildDirectoryWithName(string directoryName, out IDirectoryPath directoryPath, out string failureReason)
Parameters
directoryNamestringThe child directory name.
directoryPathIDirectoryPathThe directory path obtained.
failureReasonstringThe explanation in case this call returns false.
Returns
TryGetChildFileWithName(string, out IFilePath, out string)
Returns true if fileName doesn't contain forbidden character in path.
bool TryGetChildFileWithName(string fileName, out IFilePath filePath, out string failureReason)
Parameters
fileNamestringThe child file name.
filePathIFilePathThe file path obtained.
failureReasonstringThe explanation in case this call returns false.