Breaking News

LightBlog

Saturday, 23 January 2016

Generate Random Code In C#

Generate Random Code In C#
private void generate()
    {
        var chars = "0123456789";
        var stringChars = new char[6];
        var random = new Random();
        for (int i = 0; i < stringChars.Length; i++)
        {
            stringChars[i] = chars[random.Next(chars.Length)];
        }
        var finalString = new String(stringChars);
        ab = finalString.ToString();
     //   lblOutlet_Code.Text = finalString.ToString();
    }




No comments:

Post a Comment