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

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user