gpt4 book ai didi

c# - 将字符串值转换回 GUID 值

转载 作者:太空狗 更新时间:2023-10-29 23:55:24 24 4
gpt4 key购买 nike

我有一个 guid 值存储在我的隐藏变量中。比如说 (303427ca-2a5c-df11-a391-005056b73dd7)

现在我如何将这个隐藏字段的值转换回 GUID 值(因为我要调用的方法需要一个 GUID 值)。

谢谢。

最佳答案

只需使用重载的构造函数:

try
{
Guid guid = new Guid("{D843D80B-F77D-4655-8A3E-684CC35B26CB}");
}
catch (Exception ex) // There might be a more appropriate exception to catch
{
// Do something here in case the parsing fails.
}

关于c# - 将字符串值转换回 GUID 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2810465/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com