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