产生字符串(例:49f949d735f5c79e)
private string GenerateId() { long i = 1; foreach (byte b in Guid.NewGuid().ToByteArray()) { i *= ((int)b + 1); } return string.Format("{0:x}", i - DateTime.Now.Ticks); }
产生 Int64 类型(例:4833055965497820814)
private long GenerateId() { byte[] buffer = Guid.NewGuid().ToByteArray(); return BitConverter.ToInt64(buffer, 0); }
参考资料
http://www.cnblogs.com/SUNBOY/archive/2008/07/24/1250797.html