有的時候用戶系統用類似於QQ的號碼做為UIN
正則就行了
view sourceprint?public static Dictionary<string
{
{
{
{
{
//{
//{
{
{
{
};
public int GenerateUin()
{
var r = new Random((int)DateTime
var n = r
var tmp =
var t = n
if (!IsGoodUin(t
&& !ObjectContext
return n;
return GenerateUin();
}
public static bool IsGoodUin(string uin
{
var isGood = false;
var r
_validations
{
if (r
{
isGood = true;
r
return false;
}
return true;
});
reason = r
return isGood;
}
測試以下
view sourceprint?public void TestPresentUIN()
{
{
Console
});
}
嗯
From:http://tw.wingwit.com/Article/program/net/201311/11535.html