我试图在if条件下对此进行编码:
if (submitAnswersResponseRootObject.Response.SubmitAnswersResult.Prompts.prompt.Where(p=>p.code == 7101))
但我收到错误:
无法隐式转换类型 System.Collections.Generic.IEnumerable<> bool
我做错了什么?
答案 0 :(得分:6)
可能Any
代替Where
返回其他集合(已过滤)?
if (submitAnswersResponseRootObject.Response.SubmitAnswersResult.Prompts.prompt.Any(p=>p.code == 7101))
答案 1 :(得分:0)
也许是这样的:
if(submitAnswersResponseRootObject.Response.SubmitAnswersResult.Prompts.
prompt.Where(p=>p.code == 7101).Any())