联系我们

为客户提供超预期的高品质网站设计!

asp.net 随机码

2017-11-14 0:00:00

 private string CreateCode(int len)
    {
        string codeSerial = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";//62
        string[] arr = codeSerial.Split(',');
        string code = "";
        Random rand = new Random(unchecked((int)DateTime.Now.Ticks));
        for (int i = 0; i < len; i++)
        {
            code += arr[rand.Next(0, arr.Length - 1)];
        }
        return code;
    }

上一条新闻:C#中在内容页获取其模板页中的对象,变量,或者值
下一条新闻:Repeater 中button 获得的DropdrownList的值

 

400-915-8615 54057491 info@