我有以下 Guid:
AAB13E97-449B-4D5B-BDE2-AC479C31B782
使用 System.Guid + DbLinq + SQLite 存储它,将以下字段添加到数据库中。
973EB1AA-9B44-5B4D-BDE2-AC479C31B782
(为清楚起见添加了破折号)
我可以看到最后8个字节顺序相同,前3组是相反的,但我不明白为什么。
最佳答案
查看Wikipedia's article on the subject它说:
Data4 stores the bytes in the same order as displayed in the GUID text encoding (see below), but the other three fields are reversed on little-endian systems (for example Intel CPUs).
所以我得出结论:
- 这独立于所使用的 DBMS 或框架而发生
- 这取决于处理器架构
- 这是设计使然
所以问题仍然存在:
他们到底为什么要这样设计?
关于.net - 为什么二进制 Guids 与通常的表示不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5003061/