doramail05
asked on
Generate a upper case random guid string
below is a method for generate random string based on input length. just that the character in the random string has to be uppercase when return.
public static string GetRandomStringUsingGUID(int length)
{
// Get the GUID
string guidResult = System.Guid.NewGuid().ToString();
// Remove the hyphens
guidResult = guidResult.Replace("-", String.Empty);
// Make sure length is valid
if (((length <= 0)
|| (length > guidResult.Length)))
{
throw new ArgumentException(("Length must be between 1 and " + guidResult.Length));
}
// Return the first length bytes
return guidResult.Substring(0, length);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER