My goal is to create usernames that start with a "Z" and end with 000001 - 000048. I would like to store these in a list and then retrieve them to store in an Excel list. My code is buggy (FormatException), and so I am asking for assistance.
public static string GetUserName()
{
int length = 5;
int number = 0;
List<string> userNames = new List<string>();
for (int i = 1; i < 49; i++)
{
number = i;
string asString = number.ToString("Z" + length);
userNames.Add(asString);
}
return userNames.ToString();
}
In this section I would like to save the generated user names to the Excel list
var login = new List<string> { GetUserName(), GetUserName(), GetUserName() };