我有一段代码,可以用GUID中的空字符串替换破折号.
Replace(System.Guid.NewGuid.ToString, "-", "")
这会消除guid的唯一性吗?
还有人能证实这一点吗?
我们在数据库中以char(32)的形式存储guid.可以吗?因为我们有不同时区的国际用户,我们担心字符长度可能超过32.谢谢
我有一段代码,可以用GUID中的空字符串替换破折号.
Replace(System.Guid.NewGuid.ToString, "-", "")
这会消除guid的唯一性吗?
还有人能证实这一点吗?
我们在数据库中以char(32)的形式存储guid.可以吗?因为我们有不同时区的国际用户,我们担心字符长度可能超过32.谢谢
是的,可以go 掉破折号.Guid的唯一性是有保证的.
破折号仅用于可读性:内部Guid由16个字节组成
public Guid(int a, short b, short c, byte[] d);
public Guid(int a, short b, short c, byte d,
byte e, byte f, byte g, byte h,
byte i, byte
public Guid(uint a, ushort b, ushort c, byte d,
byte e, byte f, byte g, byte h,
byte i, byte j, byte k);