gpt4 book ai didi

c# - 运算符 '||' 不能应用于类型 'string' 和 'bool' 的操作数

转载 作者:行者123 更新时间:2023-11-30 13:38:48 25 4
gpt4 key购买 nike

我不知道为什么同时我在 linq 中编译我的查询如下

from c in PriceListPolicies_TBLs
where ((c.CountryCode ?? "VNALL")== "VNALL" ? "VN" : c.CountryCode ||
(c.CountryCode ?? "THALL") == "THALL" ? "TH" : c.CountryCode)
select c

给出这个错误

Operator '||' cannot be applied to operands of type 'string' and 'bool'

我怎样才能让这个查询起作用?

最佳答案

试试这个:

from c in PriceListPolicies_TBLs 
where
(
((c.CountryCode ?? "VNALL") == "VNALL" ? "VN" : c.CountryCode)
||
((c.CountryCode ?? "THALL") == "THALL" ? "TH" : c.CountryCode)
)
select c

关于c# - 运算符 '||' 不能应用于类型 'string' 和 'bool' 的操作数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14999150/

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