Could this cause multiple identical GUIDs?

前端 未结 4 1002
耶瑟儿~
耶瑟儿~ 2021-01-17 19:32

As GUID generation is time-dependent, if System.Guid.NewGuid() is called multiple times at the exact same instant on different threads, could it return identical GUIDs?

4条回答
  •  后悔当初
    2021-01-17 20:30

    The Transact-SQL NEWID function and the application API functions and methods generate new uniqueidentifier values from the identification number of their network card plus a unique number from the CPU clock. Each network card has a unique identification number. The uniqueidentifier value that is returned by NEWID is generated by using the network card on the server. The uniqueidentifier value returned by application API functions and methods is generated by using the network card on the client.

    .It wont generate duplicates in time or in any pc as per msdn.

提交回复
热议问题