How can I generate a GUID for a string?

后端 未结 9 1724
Happy的楠姐
Happy的楠姐 2020-12-02 14:14

I am having a problem generating a GUID for a string - for example:

Guid g = New Guid(\"Mehar\");

How can I compute a GUID for \"Meha

9条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 14:54

    I think you have a misunderstanding of what a Guid actually is. There is no Guid representation of a string such as "Mehar".

    The reason there is a new Guid(String s) overload is so that you can create a guid from a typical string representation of one, such as "00000000-0000-0000-0000-000000000000".

    See the wiki article for more information on what a Guid actually is.

    http://en.wikipedia.org/wiki/Globally_Unique_Identifier

提交回复
热议问题