Path.GetRandomFileName メソッド
定義
ランダムなフォルダー名またはファイル名を返します。Returns a random folder name or file name.
public:
static System::String ^ GetRandomFileName();
public static string GetRandomFileName ();
static member GetRandomFileName : unit -> string
Public Shared Function GetRandomFileName () As String
戻り値
ランダムなフォルダー名またはファイル名。A random folder name or file name.
例
次の例では、メソッドからの出力を示し GetRandomFileName ます。The following example show output from the GetRandomFileName method.
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 はファイルを作成しません。Unlike GetTempFileName, GetRandomFileName does not create a file.