Class TemporaryFile
Represents a temporary file that is automatically deleted when the object is disposed.
Namespace: NanoByte.Common.Storage
Assembly: NanoByte.Common.dll
Syntax
public class TemporaryFile : Object
Constructors
TemporaryFile(String, String)
Creates a uniquely named, empty temporary file on disk.
Declaration
public TemporaryFile(string prefix, string parentDirectory = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | A short string the directory name should start with. |
System.String | parentDirectory | The path of the directory the file should be created in. Leave |
Exceptions
Type | Condition |
---|---|
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.
Declaration
public string Path { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Dispose()
Deletes the temporary file.
Declaration
public virtual void Dispose()
ToString()
Returns Path.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Operators
Implicit(TemporaryFile to String)
Declaration
public static implicit operator string (TemporaryFile file)
Parameters
Type | Name | Description |
---|---|---|
TemporaryFile | file |
Returns
Type | Description |
---|---|
System.String |