Path.GetRandomFileName 메서드

정의

임의의 폴더 이름 또는 파일 이름을 반환합니다.

public:
 static System::String ^ GetRandomFileName();
public static string GetRandomFileName ();
static member GetRandomFileName : unit -> string
Public Shared Function GetRandomFileName () As String

반환

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 만들지 않습니다.

적용 대상