How to Generate the Alphanumeric number Dynamically?Its Like F001,F002,F003
Loading
How to Generate the Alphanumeric number Dynamically?Its Like F001,F002,F003
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
prabha ThangaduraiPosted Nov 17, 2007, 12:11 AM
AlanPosted Nov 16, 2007, 4:58 AM
This code should do it:
using System;
class Program
{
static void Main()
{
for (int i = 1; i < 4; i++)
{
Console.Write(GenerateNextNumber());
if (i < 3) Console.Write(",");
}
Console.ReadLine();
}
static int lastNumber = 0;
static string GenerateNextNumber()
{
return "F" + String.Format("{0:D3}", ++lastNumber);
}
}