C# Simple Password Generator
Posted: 28/02/2012 Filed under: Programming | Tags: C# Leave a comment »One of the simplest and easiest approach to generating random passwords, is to use the GetRandomFileName() static method from the Path class.
Snippet below demonstrates this.
1: using System;
2: using System.IO;
3:
4: static void Main(string[] args)
5: {
6: // Calls the static method from the Path type
7: var randomFolderFile = Path.GetRandomFileName();
8:
9: // Strips out dot characters
10: randomFolderFile = randomFolderFile.Replace(".", "");
11: Console.WriteLine(randomFolderFile);
12: }
Happy Coding.