An easy and fast way to create unique ID's for your application is GUIDs,
A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.
in C# we create a new guid like so:
System.Guid guid=System.Guid.NewGuid();
this will generate a guid out of your local MAC (network adapter physical address which itself is unique) your local time, and more...if you run this more then once: guid=System.Guid.NewGuid(); you are guaranteed to NEVER get the same guid again.
9:49:14 AM
|