C# 生成Guid的几种方法

string guid = Guid.NewGuid().ToString(); // db2429d9-872c-4799-b6e5-b239b878e933

string guidN = Guid.NewGuid().ToString("N"); // db2429d9872c4799b6e5b239b878e933

string guidB = Guid.NewGuid().ToString("B"); // {db2429d9-872c-4799-b6e5-b239b878e933}

string guidP = Guid.NewGuid().ToString("P"); // (db2429d9-872c-4799-b6e5-b239b878e933)

string guidX = Guid.NewGuid().ToString("X"); // {0xec43ff47,0xb913,0x400c,{0x9b,0x8d,0x07,0x2e,0x15,0x01,0x30,0x29}}

posted @ 2020-07-28 21:29  SelenaZhou  阅读(1653)  评论(0编辑  收藏  举报