how we can generate custom identities in LT/14-15/0000001 format in c#


how can generate custom identities in lt/14-15/0000001 format in c#.

i want create id in given format in 14-15 should related current year , and 0000001 should increase every time when generate, using c# coding please me........


try following method:

        private static int counter;         private static string generatestring()         {             string s = string.format("lt/{0}-{1}/{2}",                  datetime.now.year.tostring().substring(2),                  datetime.now.addyears(1).year.tostring().substring(2),                 (++counter).tostring("d7"));                          return s;         }

usage:

string first = generatestring(); //= lt/14-15/0000001 string second = generatestring(); //= lt/14-15/0000002




Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

SQL Server 2008 - High Memory Usage

Problem In Configuring Biztalk 2009 In Creating A ReceivePort.When I Try To Create A Receive POrt I Got This Error

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts