Memory uses of Guid and string

  • Thread starter Thread starter Arjen
  • Start date Start date
A

Arjen

Hi,

I have a Guid value. I want to save this inside the memory.
What is the best way: save it as a Guid? Or as string?

Thanks!
 
Arjen,

As a Guid. You can always get a string representation by calling
ToString on the Guid parameter. If you can get type safety, take it. In
this case, there is a clear object representation for a Guid, so you should
use that.

Hope this helps.
 
Nicholas said:
Arjen,

As a Guid. You can always get a string representation by calling
ToString on the Guid parameter. If you can get type safety, take it.
In this case, there is a clear object representation for a Guid, so
you should use that.

Hope this helps.

plus, a Guid probably uses integer types to store (parts of) the value,
which is much more compact (128 bits) than the string representation
(36 x 16 bits = 576 bits). But of course this will only really matter
if you store lots of them, what is 56 bytes nowadays?


Hans Kesting
 
Back
Top