Directory.CreateTempSubdirectory(String) Method

Definition

Creates a uniquely named, empty directory in the current user's temporary directory.

C#
public static System.IO.DirectoryInfo CreateTempSubdirectory(string? prefix = default);

Parameters

prefix
String

An optional string to add to the beginning of the subdirectory name.

Returns

An object that represents the directory that was created.

Exceptions

prefix contains a directory separator.

A new directory cannot be created.

Applies to

Product Versions
.NET 7, 8, 9, 10