Search code examples
.netvb.netguiddatamapper

.NET Native GUID conversion


I have an external database that is feeding information to me. One saves their data as native GUID format and my other data source supplies standard .NET GUID format string.

Is there a tidy way to convert from Native GUID to GUID Structure?

Also is there any validation bit to determine if a provided value is a Native GUID or not? I can't seem to find any if there is one.

The difference is as follows:

typedef struct _GUID 
{  
   DWORD Data1;  
   WORD Data2;  
   WORD Data3;  
   BYTE Data4[8];
} GUID;

Data1, Data2 and Data3 get their byte order reversed but Data4 remains the same, see http://en.wikipedia.org/wiki/Globally_unique_identifier for more info


Solution

  • If I understand the question correctly, I posted extension methods that do this in How to read a .NET Guid into a Java UUID.