Generate Unique ID in C#.NET

Naimishforu
Posted by Naimishforu under C# category on | Points: 40 | Views : 6165
Just a demo example as below :

private string GenerateRandomCode()
{
string s = "";
Random objrand = new Random();
char[] arr = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
for (int i = 0; i < 3; i++)
{
s = s + arr[objrand.Next(26)].ToString() + objrand.Next(10).ToString();
}
return s;
}


You can modify it as you want

Comments or Responses

Posted by: Tripati.patro on: 2/21/2011 Level:Starter | Status: [Member] | Points: 10
Good One...

Login to post response