is this want you wanted?
static List<string> GenID(int n)
{
string prefix = "ABC";
char zero = '0';
List<string> idList = new List<string>();
string next = "";
int nzeros = 0;
if (n > 0)
{
for (int k = 1; k <= n; k++)
{
next = prefix;
if (k <= 9) nzeros = 3;
else if (k <= 99) nzeros = 2;
else if (k <= 999) nzeros = 1;
else nzeros = 0;
for (int j = 0; j < nzeros; j++)
{
next += zero.ToString();
}
next += k.ToString();
idList.Add(next);
}
}
return idList;
}
</string></string></string>