How to convert a GUID to a string in C#?

前端 未结 10 941
挽巷
挽巷 2020-12-15 02:20

I\'m new to C#.

I know in vb.net, i can do this:

Dim guid as string = System.Guid.NewGuid.ToString

In C#, I\'m trying to do

10条回答
  •  甜味超标
    2020-12-15 03:10

    Guid guidId = Guid.Parse("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
    string guidValue = guidId.ToString("D"); //return with hyphens
    

提交回复
热议问题