标签:sgid 生成 str pre random 避免 c# for new
public string GetMsgID()
{
Random rand = new Random((int)DateTime.Now.Ticks);
string szRand = rand.Next(0, 9999).ToString().PadLeft(4, ‘0‘);
return string.Format("{0}{1}", DateTime.Now.ToString("yyyyMMddHHmmss"), szRand);
}
标签:sgid 生成 str pre random 避免 c# for new
原文地址:http://www.cnblogs.com/zuifengke/p/dd8a349559231a138661a1b9bcdf1975.html