What is the best method to get Int32 from the first four bytes of a GUID?

I'm just wondering if this is the best solution for this.

BitConverter.ToInt32(sample_guid.ToByteArray(), 0)
+5
source share
3 answers

I do not think there is a better solution than this.

+3
source

I don't know if this is better, but easier to read:

Int32.Parse (sample_guid.ToString () substring (0,1).);

I am admittedly a junior developer, but the above is easier for me than converting a byte, and on a modern computer it will be indistinguishable quickly.

+1
source

, , Int32 ( ) .

- Guid, . , .

0

All Articles