转换GUID来长 [英] converting GUID to long
问题描述
我需要开发在C#中不断increSing计数器。我想GUID转换为长。这有可能在C#中?是否有任何其他的方式来开发不断增加的反
I need to develop an ever increSing counter in C#. I am thinking about converting GUID to long. Is that possible in c#? Is there any other way to develop an ever increasing counter?
推荐答案
没有,一个的 GUID 是128位,所以不适合在长,因为这是64位。一个 System.Decimal 是128位,所以给你找很长的路要走,但当然也有它的局限性。即使您保存在柜台一个字符串有其极限。 。计算机alsways有很大的局限性,你必须找到一个这是足够大的,因此您可以持续一段时间。
No, a GUID is 128 bit so won't fit in your long since that is 64 bit. A System.Decimal is 128 bit so will get you a long way, but of course that also has it's limits. Even if you save your counter in a string it has its limits. Computers alsways have limits, you will have to find one which is big enough so you can continue for a while.
编辑:
在.NET 4.0中存在的 BigInteger的可以是相当大的,但要记住,即使是有其局限性,因为它必须适合在内存中。
In .Net 4.0 there is a BigInteger which can be pretty big, but remember, even that has its limits since it has to fit in memory.
这篇关于转换GUID来长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!