Why are there dashes in a .NET GUID?

后端 未结 13 846
傲寒
傲寒 2020-12-03 00:11

Why are there dashes in a .NET GUID? Are there dashes in most implementations of a GUID, or is it just a Microsoft thing?

Signed,

741ecf77-9c92-4435-8e6b-859

相关标签:
13条回答
  • 2020-12-03 01:14

    Hyphens denote the byte structure of a Guid.

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

    For:

    (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX)
    

    You can probably strip them before saving. At least in .NET the constructor of the Guid type will initialize a Guid variable from its string representation regardless of whether the hyphens are still there or removed.

    0 讨论(0)
提交回复
热议问题