there are many ways to generate random strings. You could develop a method that populates a char array using the Random class, and then returns a string based on those numbers.
However We can access the Path.GetRandomFileName static method, which returns appropriate strings.
Detail This method gets a random file name, gets the correct output path on the C:\ volume, and then writes some text to it.
Return The Path.GetRandomFileName method returns a random file name with an extension. This includes the period before the extension.
Tip The extension will be 1 dot and 3 letters, while the name will be 8 characters. All the characters are valid file name characters.
static void Main()
// Write three random files.
static void WriteRandomFile
// Get random file name.
string fileName = Path.GetRandomFileName()
// Construct full path.
string outputPath = Path.Combine("C:\\"
// Write to screen and disk.