Path::GetRandomFileName Method ()

 

Returns a random folder name or file name.

Namespace:   System.IO
Assembly:  mscorlib (in mscorlib.dll)

public:
static String^ GetRandomFileName()

Return Value

Type: System::String^

A random folder name or file name.

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

The following example show output from the GetRandomFileName method.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show: