我需要 .NET 中的唯一标识符(不能使用 GUID,因为它对于这种情况来说太长了)。
人们是否认为该算法使用here是一个不错的候选人还是您有任何其他建议?
最佳答案
还有这里 YouTube-like GUID
你可以使用 Base64:
string base64Guid = Convert.ToBase64String(Guid.NewGuid().ToByteArray());
That generates a string like E1HKfn68Pkms5zsZsvKONw==. Since a GUID is always 128 bits, you can omit the == that you know will always be present at the end and that will give you a 22 character string. This isn't as short as YouTube though.
关于c# - .NET 短唯一标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9278909/