System. guid. newguid (). tostring () The Globally Unique Identifier (guid) is a alphanumeric identifier used to indicate the unique installation of the product. Guids are used in many popular software applications, such as web browsers and media players.
The GUID format is "XXXXXXXX-XXXX-xxxxxxxxxxxx", where each X is a hexadecimal number in the range of 0-9 or a-f. For example, 6f9619ff-8b86-d011-b42d-00c04fc964ff is a valid guid value.
Why use guid?
No two computers in the world will generate duplicate guid values. GUID is used to assign a unique identifier to a network or system with multiple nodes and computers. On Windows, GUID is widely used: Registry, class and interface identifiers, databases, and even automatically generated machine names and directory names.
Guid. newguid () indicates the rule for generating unique codes.
System. guid. newguid (). tostring (format );
Example:
String STR = system. guid. newguid (). tostring ("N") + "|"
+ System. guid. newguid (). tostring ("D") + "|"
+ System. guid. newguid (). tostring ("B") + "|"
+ System. guid. newguid (). tostring ("p ");
Response. Write (STR );
Returned results:
Ece4f4a60b764339b94a07c84e338a27 |
5bf99df1-dc49-4023-a34a-7bd80a42d6bb |
{2280f8d7-fd18-4c72-a9ab-405de3fcfbc9} |
(25e6e09f-fb66-4cab-b4cd-bfb429566133)
Format of the return value
N 32-bit:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
D 32-digit numbers separated by a hyphen:
XXXXXXXX-XXXX-xxxxxxxxxxxx
B is a 32-bit number separated by a hyphen in braces:
{XXXXXXXX-XXXX-xxxxxxxxxxxx}
P contains a 32-bit number separated by a hyphen in parentheses:
(XXXXXXXX-XXXX-xxxxxxxxxxxx)