When you want print out GUID like this format
{855F9A70-9A43-435B-A5B1-B91A7F58BAD1} => bracket surrounded….
you can use that one.
For example, Guids of SPlist or SPField
guid.ToString(”B”).ToUpper();
[Sample Code here]:
[code:c#;ln=on]
string strGuid = "0b51264d-baa6-49dc-8970-1d24979053ac";
Guid guid = new Guid(strGuid);
string guidBTest1 = guid.ToString();
string guidBTest2 = guid.ToString("B").ToUpper();
Response.Write(guidBTest1 + "");
Response.Write(guidBTest2);
[/code]
[In Detail]
The format parameter can contain the following format specifiers. In the table that follows, all digits in the return value are hexadecimal. Each character ‘x’ represents a hexadecimal digit; each hyphen (’-'), bracket (’{', ‘}’), and parenthesis (’(', ‘)’) appears as shown.
Specifier | Format of Return Value |
N |
32 digits:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
D |
32 digits separated by hyphens:
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
B |
32 digits separated by hyphens, enclosed in brackets:
{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} |
P |
32 digits separated by hyphens, enclosed in parentheses:
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) |
The provider parameter is reserved for future use and does not contribute to the execution of this method. A null reference can be coded for this parameter.
- Reference from http://msdn.microsoft.com/en-us/library/s6tk2z69.aspx