Guid.NewGuid().GetHashCode() for DB
问题 Would this be reliable for using as an ID for data storage(SQL Server)? I would use a guid but I prefer a numeric value. 回答1: Would this be reliable for using as an ID for data storage(SQL Server)? No. GUIDs are 128-bit but hashcodes are 32-bit. Therefore, there are necessarily collisions. It may be unlikely that you ever encounter one, but you are not guaranteed to never encounter one. What you want for reliability is a guarantee that you never encounter a collision. If you insist on using