How to Generate the Alphanumeric number Dynamically?Its Like F001,F002,F003
Automatic Generation
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
AlanRank #669 · 3.6K reputationPosted Nov 15, 2007, 11:58 PM EST
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);
}
}
prabha Thangadurai19 reputationPosted Nov 16, 2007, 7:11 PM EST