public static string NewPassword() { bool includeLowercase = true; bool includeUppercase = true; bool includeNumeric = true; bool includeSpecial = true; bool includeSpaces = false; int lengthOfPassword = 12; string password = PasswordGenerator.GeneratePassword(includeLowercase, includeUppercase, includeNumeric, includeSpecial, includeSpaces, lengthOfPassword); while (!PasswordGenerator.PasswordIsValid(includeLowercase, includeUppercase, includeNumeric, includeSpecial, includeSpaces, password)) { password = PasswordGenerator.GeneratePassword(includeLowercase, includeUppercase, includeNumeric, includeSpecial, includeSpaces, lengthOfPassword); } return(password); }