//建立類別庫
using System;
using System.Collections.Generic;
using System.Text;
namespace Cls_Authority
{
public class Class1
{
/// <summary>
/// 產生WordLen長度的一組亂數碼
/// </summary>
/// <param name="WordLen">決定產生亂數碼長度</param>
/// <returns></returns>
public string GenerateAuthWord(int WordLen)
{
int RanValue;
string bufstr = "";
Random rnd = new Random(DateTime.Now.Millisecond);
for (int i = 0; i < WordLen; i++)
{
RanValue = (int)rnd.Next(0, 9);
bufstr = bufstr + RanValue.ToString();
}
return bufstr;
}
}
}
//建立dll 然後就可以使用了 先參考dll 然後 聲名
// 參考名.類名 Auth = new 參考名.類名();
// text1.text = Auth.GenerateAuthWord(10);