Generation format of GUIDs in C # (Guid.tostring method)

Source: Internet
Author: User

GUID 是微软对UUID这个标准的实现。UUID是由开放软件基金会(OSF)定义的。UUID还有其它各种实现,不止GUID一种

public string ToString( 
    string format 

The format parameter can be "N", "D", "B", "P", or "X". if format is null or an empty string (""), use "D"

The following table shows the format specifier that is accepted as the formatting parameter. " 0" denotes a number; the hyphen ("-"), the curly brace ("{", "}"), and the Parentheses ("(", ")") are shown below.


Format of the return value


32-digit number:



32-digit number separated by hyphens:



32 digits separated by hyphens, enclosed in curly braces:



A 32-digit number separated by a hyphen enclosed in parentheses:



Four hexadecimal values are enclosed in curly braces, where the fourth value is also a subset of the eight hexadecimal values enclosed in curly braces:

{0x00000000, 0x0000, 0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00}}

The hexadecimal digits A through F are lowercase in the returned string. to convert them to uppercase, call the string returned by the Stringtoupper method.

Generation format of GUIDs in C # (Guid.tostring method)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.