<分区>
为什么转换(到 System.Guid 类型)语句无效(try block 中的第二行)?
例如,假设我有一个值为“5DD52908-34FF-44F8-99B9-0038AFEFDB81”的字符串。我想将其转换为 GUID。这不可能吗?
Guid ownerIdGuid = Guid.Empty;
try
{
string ownerId = CallContextData.Current.Principal.Identity.UserId.ToString();
ownerIdGuid = (Guid)ownerId;
}
catch
{
// Implement catch
}