Method Create
Create(ReadOnlySpan<char>, PathOptions)
Creates a cached info snapshot for an existing file or directory at the specified absolute path. The returned instance is either a CachedFileInfo or CachedDirectoryInfo depending on the entry's type.
Declaration
public static CachedEntryInfo Create(ReadOnlySpan<char> path, PathOptions options = PathOptions.NoUnfriendlyNames)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<char> | path | An absolute path to an existing file or directory, using the current platform's format. |
| PathOptions | options | Specifies the path parsing options for |
Returns
| Type | Description |
|---|---|
| CachedEntryInfo |
Remarks
If path is directory-shaped (i.e. it ends with a separator or a navigational segment) then it must point to a directory; an
IOException is thrown if it instead resolves to a file. If path is file-shaped then either a file or a directory at
that path is accepted.
Exceptions
| Type | Condition |
|---|---|
| FileNotFoundException | No file or directory exists at the specified path. |
| DirectoryNotFoundException | A parent directory in the specified path does not exist. |
| IOException | The path is directory-shaped but resolves to a file. |