产生字符串(例: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

相关文章:

  • 2022-01-08
  • 2021-08-06
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
相关资源
相似解决方案