Guid.NewGuid (). Several formats for ToString ()

Source: Internet
Author: User

System.Guid.NewGuid (). The ToString () Global Unique identifier (GUID) is an alphanumeric identifier that indicates the uniqueness of the product identity
 Public string ToString (    string  format)
Parameters
Format
Type: System . String
A single-format specifier that indicates how to format thisThe value of the guid .  format parameter can be "n","d", "b","p", or & quot X". " The >format  parameter can be "N", "D", "B", "P" or "X".  format is null or an empty string (" "),"D"is used." > if  format  for     or an empty string (""), use "D".  
Return value type: System. String
the value of this Guid, expressed in a series of lowercase hexadecimal bits in the specified format.

The following table shows the format specifiers that are accepted by the format parameter. "0" represents a number; the hyphen ("-"), curly braces ("{", "}"), and parentheses ("(", ")") are displayed as shown below.

Specifiers

Format of the return value

N

32-bit:

00000000000000000000000000000000

D

32-digit number separated by hyphens:

00000000-0000-0000-0000-000000000000

B

32-bit numbers enclosed in curly braces, separated by hyphens:

{00000000-0000-0000-0000-000000000000}

p

(00000000-0000-0000-0000-000000000000)

X

4 hexadecimal values enclosed in curly braces, where the 4th value is a subset of 8 hexadecimal values (also enclosed in curly braces):

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

The hexadecimal digits A through F are examples in the returned string. to convert them to uppercase, call the string in the returned strings . ToUpper method.

Guid.NewGuid (). Several formats for ToString ()

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: info-contact@alibabacloud.com 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.