C# - Guid ToString Format

/** * Guid ToString Format **/ using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here Guid guid = Guid.NewGuid(); Console.WriteLine(guid.ToString("N")); //output: e3051b6e327f42619a1fa18602751ee3 Console.WriteLine(guid.ToString("D")); //output: e3051b6e-327f-4261-9a1f-a18602751ee3 Console.WriteLine(guid.ToString("B")); //output: {e3051b6e-327f-4261-9a1f-a18602751ee3} Console.WriteLine(guid.ToString("P")); //output: (e3051b6e-327f-4261-9a1f-a18602751ee3) Console.WriteLine(guid.ToString("X")); //output: {0xe3051b6e,0x327f,0x4261,{0x9a,0x1f,0xa1,0x86,0x02,0x75,0x1e,0xe3}} } } } /** N 32 位數字︰ 00000000000000000000000000000000 D 以連字號分隔的 32 位數字︰ 00000000-0000-0000-0000-000000000000 B 以連字號、 括號括住分隔的 32 位數字︰ {00000000-0000-0000-0000-000000000000} P 以連字號放在括號分隔的 32 位數字︰ (00000000-0000-0000-0000-000000000000) X 括號,其中第四個值是八個十六進位值的子集,也會括在大括號括住的四個十六進位值︰ {0x00000000、 0x0000、 0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} **/

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.