Language: C#
Generate a random string based on length in c#
public string GetRandomPasswordUsingGUID(int length) { string guidResult = System.Guid.NewGuid().ToString(); guidResult = guidResult.Replace("-", string.Empty); if (length <= 0 || length > guidResult.Length) throw new ArgumentException("Length must be between 1 and " + guidResult.Length); return guidResult.Substring(0, length); }
Tags:
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

