Table of Contents

Class TemporaryFile

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

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 string

A short string the directory name should start with.

parentDirectory string

The 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

string

Methods

Dispose()

Deletes the temporary file.

public virtual void Dispose()

ToString()

Returns Path.

public override string ToString()

Returns

string

Operators

implicit operator string(TemporaryFile)

public static implicit operator string(TemporaryFile file)

Parameters

file TemporaryFile

Returns

string