当我在 LinqPad 中运行时
var ProductIds = from p in Products
where p.Id = "F1FE990C-4525-4BFE-9E2C-A7AFFF0DDA1F"
select p;
ProductIds.Dump();
它给了我
Cannot implicitly convert type 'string' to 'System.Guid'
我只是不知道如何将其正确转换为我猜的 GUId
最佳答案
尝试使用 Guid.Parse(string guid)
静态方法。
var ProductIds = from p in Products
where p.Id == Guid.Parse("F1FE990C-4525-4BFE-9E2C-A7AFFF0DDA1F")
select p;
ProductIds.Dump();
关于c# - 使用 LinqPad 将字符串转换为 Guid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8067628/