Quantcast
Channel: Do I need to verify the uniqueness of a GUID? - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Do I need to verify the uniqueness of a GUID?

$
0
0

I saw this function in a source written by my coworker

private String GetNewAvailableId(){    String newId = Guid.NewGuid().ToString();    while (clientsById.ContainsKey(newId))    {        newId = Guid.NewGuid().ToString();    }    return newId;}

I wonder if there is a scenario in which the guid might not be unique?The code is used in a multithread scenario and clientsById is a dictionary of GUID and an object


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images