Path.GetRandomFileName 方法    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回随机文件夹名或文件名。
public:
 static System::String ^ GetRandomFileName();public static string GetRandomFileName ();static member GetRandomFileName : unit -> stringPublic Shared Function GetRandomFileName () As String返回
随机文件夹名或文件名。
示例
以下示例显示 方法的 GetRandomFileName 输出。
using System;
using System.IO;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string result = Path.GetRandomFileName();
            Console.WriteLine("Random file name is " + result);
        }
    }
}
/*
 This code produces output similar to the following:
 Random file name is w143kxnu.idj
 Press any key to continue . . .
 */
Imports System.IO
Module Module1
    Sub Main()
        Dim result = Path.GetRandomFileName()
        Console.WriteLine("Random file name is " + result)
    End Sub
End Module
' This code produces output similar to the following:
' Random file name is w143kxnu.idj
' Press any key to continue . . .
注解
与 不同 GetTempFileName, GetRandomFileName 不会创建文件。