Table of Contents

Class TemporaryDirectory

Namespace
NanoByte.Common.Storage
Assembly
NanoByte.Common.dll

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 string

A short string the directory name should start with.

parentDirectory string

The 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

string

Methods

Dispose()

Deletes the temporary directory.

public virtual void Dispose()

ToString()

Returns Path.

public override string ToString()

Returns

string

Operators

implicit operator string(TemporaryDirectory)

public static implicit operator string(TemporaryDirectory dir)

Parameters

dir TemporaryDirectory

Returns

string