为何会出现在.NET GUID破折号? [英] Why are there dashes in a .NET GUID?

查看:175
本文介绍了为何会出现在.NET GUID破折号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为何会出现在.NET GUID破折号?是否有破折号一个GUID的大多数实现,或者是它只是一个微软的东西?

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

签名,

741ecf77-9c92-4435-8e6b-85975bd13452

741ecf77-9c92-4435-8e6b-85975bd13452

推荐答案

从技术上讲,有一个 GUID 。 GUID是它通常存储在下面的方式一个128位的值(使用C#这里重新present结构):

Technically, there are no "dashes" in a GUID. A GUID is a 128-bit value which is usually stored in the following manner (using C# here to represent the structure):

public struct Guid
{
  public ulong Data1;
  public ushort Data2;
  public ushort Data3;
  public fixed byte Data4[8];
}

破折号是在字符串重新presentation一个GUID的的。

破折号是可选的,不需要在字符串再一个GUID的presentation。

The dashes are optional and are not required in a string representation of a GUID.

这是说,有地方安置的短划线,涉及到的GUID是如何历史的原因,以生成的,但历史的语义不再适用。

That said, there are historical reasons as to where the placement of the dashes are, related to how the GUIDs were generated, but that historical semantic no longer applies.

这篇关于为何会出现在.NET GUID破折号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆