![c# 生成唯一guid](https://img-blog.csdnimg.cn/img_convert/ff774098872904b4f8649a7269ee7d72.png)
c# 生成唯一guid
Globally Unique Identifier (GUID) is a pseudo-random string which consists of 32 letters, numbers (0-9), and 4 hyphens to separate letters. These letters are randomly generated. In probability theory, this value is unique and can be used as a secret and session cookie, etc.
全局唯一标识符(GUID)是一个伪随机字符串,由32个字母,数字(0-9)和4个连字符组成,以分隔字母。 这些字母是随机生成的。 在概率论中,此值是唯一的,可用作秘密和会话Cookie等。
GUID示例 (Example GUID)
The following line provides a GUID. as we can see there are 4 dashes that separate the values into 5 parts. The first part consist of 6 letters, second part 4, third part 4, forth part 4, and the last fifth part 12 letters. They are generated randomly.
下一行提供了一个GUID。 如我们所见,有4个破折号将值分成5个部分。 第一部分包含6个字母,第二部分包含4个字母,第三部分包含4个字母,第四部分包含4个字母,最后第五部分包含12个字母。 它们是随机生成的。
5c981150-9d1d-11e8-98fa-000c297195d3
在Linux中生成GUID (Generate GUID In Linux)
Linux provides a lot of different tools to generate GUID. But one of the most simple and default installed tool is uuidgen
. We just issue the command like below.
Linux提供了许多不同的工具来生成GUID。 但是,最简单和默认安装的工具之一是uuidgen
。 我们只是发出如下命令。
$ uuidgen
在Windows中生成GUID (Generate GUID In Windows)
Windows operating systems like Server 2008, 20012, 2016, 7, 8, 10 have the ability to generate GUID in PowerShell, 3rd party tools, etc. But the most integrated and fast way is using PowerShell which actually uses .Net libraries we have already examined in Generating GUID with C#
.
Windows操作系统(例如Server 2008、20012、2016、7、8、10)能够在PowerShell,第三方工具等中生成GUID。但是,最集成和最快的方法是使用PowerShell,而PowerShell实际上使用了我们已经拥有的.Net库。在