Incremental GUID

  • Thread starter Thread starter Alexander Muylaert
  • Start date Start date
A

Alexander Muylaert

Hi

I need a unique key for an object. This key needs to be globally unique. A
GUID serves my needs, but...

Is somebody aware of a guid implementation that always returns a bigger
GUID? The current GUUD.NewGuid implementation might return a smaller guid
value. It would make my job easier when it would return a bigger guid.

kind regards

Alexander
 
According to the definition of GUID:
"A unique 128-bit number that is produced by the Windows OS or by some
Windows applications to identify a particular component, application,
file, database entry, and/or user."
Guid.NewGuid returns a 128bit number, that is fairly OK.. I don't know
what do you mean by Bigger or Smaller GUIDs, please explain in some
detail.

Maqsood Ahmed
Kolachi Advanced Technologies
 
Yeh,

I'm sorry I don't mean in Size. 16 bytes is more than enough :-)

I mean ...

I keep my data sorted by this GUID. When I assign my list to the datagrid,
it shows the objects ordered by GUID. When I insert a new one through the
grid, it inserts the new object somewhere in the list, but the grid doesn't
focus on this one. The grid assumes I'm editing the last one.

kind regards

Alexander
 
Alexander said:
Hi

I need a unique key for an object. This key needs to be globally
unique. A GUID serves my needs, but...

Is somebody aware of a guid implementation that always returns a
bigger GUID? The current GUUD.NewGuid implementation might return a
smaller guid value. It would make my job easier when it would return
a bigger guid.

You could use interop and call either:

See: UuidCreate
http://msdn.microsoft.comlibrary/en-us/rpc/rpc/uuidcreate.asp

for OSes <= NT

or use

See: UuidCreateSequential
http://msdn.microsoft.com/library/en-us/rpc/rpc/uuidcreatesequential.asp

for OSes > NT

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
Perfect!

Just what I needed. You have no idea how much time you saved me :-)

Thanks
 
Back
Top