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