Class BaseAndSubDirectory
Represents a directory structure with a base directory and a subdirectory, providing methods for path manipulation and resolution.
public class BaseAndSubDirectory
- Inheritance
-
BaseAndSubDirectory
- Inherited Members
- Extension Methods
Constructors
BaseAndSubDirectory()
Initializes a new instance of the BaseAndSubDirectory class with default base and subdirectory values (".").
public BaseAndSubDirectory()
BaseAndSubDirectory(BaseAndSubDirectory)
Initializes a new instance of the BaseAndSubDirectory class by copying values from another instance.
public BaseAndSubDirectory(BaseAndSubDirectory src)
Parameters
src
BaseAndSubDirectoryThe source instance to copy from
BaseAndSubDirectory(string, string)
Initializes a new instance of the BaseAndSubDirectory class with the specified base directory and subdirectory.
public BaseAndSubDirectory(string baseDirectory, string subDirectory)
Parameters
baseDirectory
stringThe base directory path
subDirectory
stringThe subdirectory path relative to the base directory
Properties
AbsoluteDirectory
Gets or sets the absolute directory path by combining the base directory and subdirectory. When setting, calculates the subdirectory as a relative path from the base directory.
public string AbsoluteDirectory { get; set; }
Property Value
Remarks
Returns null if the base directory is null.
BaseDirectory
Gets or sets the root directory of the path structure.
public string BaseDirectory { get; set; }
Property Value
IsPathUnderBaseDirectory
Gets a value indicating whether the absolute directory is a descendant of the base directory.
public bool IsPathUnderBaseDirectory { get; }
Property Value
Remarks
Returns false if the base directory is null.
SubDirectory
Gets or sets the directory path relative to the base directory. The path is automatically normalized to use forward slashes.
public string SubDirectory { get; set; }
Property Value
Methods
GetAbsolutePath(string)
Gets the absolute path by combining the absolute directory with a file name.
public string GetAbsolutePath(string fileName)
Parameters
fileName
stringThe file name to append to the absolute directory path
Returns
- string
The combined absolute path with forward slashes as directory separators, or null if the base directory is null