1. Multi-digit alphanumeric characters, each value 0-9a-z
1 /// <summary>2 ///gets the next sequential code based on the previous (alphanumeric combination)3 /// </summary>4 /// <param name= "str" >Previous sequence Code</param>5 /// <returns></returns>6 Public Static stringEsequencecode (stringcode)7 {8 if(string. Isnullorwhitespace (code))9 {Ten return ""; One } ACode =code. ToUpper (); - intMax = -;intMin = -; - //Array 48-57 English 65-90 (uppercase)/97-122 (lowercase) the Char[] STRs =code. ToCharArray (); -ASCIIEncoding ASCII =Newasciiencoding (); - for(inti = STRs. Length-1; I >-1; i--) - { + intASCII = ASCII. GetBytes (Strs[i]. ToString ()) [0]; - intAsciinew = (ASCII = = Max min: ASCII + (ASCII = = $?8:1))); + byte[] ByteArray =New byte[] { (byte) asciinew}; AStrs[i] =Convert.tochar (ASCII. GetString (ByteArray)); at if(AscII! =max) - { - Break; - } - } - return string. Join ("", STRs); in}
View Code
C#_ take random characters