C# Path GetRandomFileName

Description

Path GetRandomFileName Returns a random folder name or file name.

Syntax

Path.GetRandomFileName has the following syntax.


public static string GetRandomFileName()

Returns

Path.GetRandomFileName method returns A random folder name or file name.

Example

The following example show output from the GetRandomFileName method.


//from w  w  w .j  ava2s .com
using System;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        string result = Path.GetRandomFileName();
        Console.WriteLine("Random file name is " + result);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter