Interface IFilePath
Represents a path to a file on file system.
public interface IFilePath : IPath
- Inherited Members
- Extension Methods
Remarks
The path can be relative or absolute. In case of an absolute IFilePath, the path represented can exist or not. The extension method ToFilePath(string) can be called to create a new IFilePath object from a string.
Properties (3)
FileExtension
Gets a string representing the file name extension.
string FileExtension { get; }
Property Value
- string
Returns the file name extension if any, else returns an empty string.
FileName
Gets a string representing the file name with its extension if any.
string FileName { get; }
Property Value
- string
Returns the file name with its extension if any.
FileNameWithoutExtension
Gets a string representing the file name without its extension if any.
string FileNameWithoutExtension { get; }
Property Value
- string
Returns the file name without its extension if any.
Methods (5)
GetBrotherDirectoryWithName(string)
Returns a new directory path representing a directory with name directoryName, located in the same directory as this file.
IDirectoryPath GetBrotherDirectoryWithName(string directoryName)
Parameters
directoryNamestringThe brother directory name.
Returns
Remarks
This file nor the returned directory need to exist for this operation to complete properly.
GetBrotherFileWithName(string)
Returns a new file path referring to a file with name fileName, located in the same directory as this file.
IFilePath GetBrotherFileWithName(string fileName)
Parameters
fileNamestringThe brother file name
Returns
Remarks
This file nor the returned file need to exist for this operation to complete properly.
HasExtension(string)
Gets a value indicating whether this file name has the extension, extension.
bool HasExtension(string extension)
Parameters
extensionstringThe file extension. It must begin with a dot followed by one or many characters.
Returns
- bool
true if this file name has the extension,
extension.
HasFileName(string)
Gets a value indicating whether this file name has the file name, fileName.
bool HasFileName(string fileName)
Parameters
fileNamestringThe file name to compare with
Returns
- bool
true if this file name has the file name,
fileName.
Remarks
This method is for performance and avoid allocation a string through the getter of FileName.
UpdateExtension(string)
Returns a new file path representing this file with its file name extension updated to newExtension.
IFilePath UpdateExtension(string newExtension)
Parameters
newExtensionstringThe new file extension. It must begin with a dot followed by one or many characters.
Returns
Remarks
The returned file nor this file need to exist for this operation to complete properly.