System.IO.Path.GetRandomFileName Method

Returns a random folder name or file name.

Syntax

public static string GetRandomFileName ()

Returns

A random folder name or file name.

Remarks

The Path.GetRandomFileName method returns a cryptographically strong, random string that can be used as either a folder name or a file name. Unlike Path.GetTempFileName, Path.GetRandomFileName does not create a file. When the security of your file system is paramount, this method should be used instead of Path.GetTempFileName.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0