Class TemporaryDirectory
Represents a temporary directory that is automatically deleted when the object is disposed.
[MustDisposeResource]
public class TemporaryDirectory
- Inheritance
-
TemporaryDirectory
- Derived
- Extension Methods
Constructors
TemporaryDirectory(string, string?)
Creates a uniquely named, empty temporary directory on disk.
public TemporaryDirectory(string prefix, string? parentDirectory = null)
Parameters
prefix
stringA short string the directory name should start with.
parentDirectory
stringThe path of the parent directory the new directory should be created in. Leave
null
to use the default temp directory.
Exceptions
- IOException
A problem occurred while creating the temporary directory.
- UnauthorizedAccessException
Creating a directory in GetTempPath() is not permitted.
Properties
Path
The fully qualified path of the temporary directory.
public string Path { get; }
Property Value
Methods
Dispose()
Deletes the temporary directory.
public virtual void Dispose()
ToString()
Returns Path.
public override string ToString()
Returns
Operators
implicit operator string(TemporaryDirectory)
public static implicit operator string(TemporaryDirectory dir)