无法将类型System.Collections.Generic.IEnumerable <>转换为bool

Hum*_*Ali 0 c# linq collections

我试图在if条件下编写代码:

if (submitAnswersResponseRootObject.Response.SubmitAnswersResult.Prompts.prompt.Where(p=>p.code == 7101))
Run Code Online (Sandbox Code Playgroud)

但是我收到了错误:

无法隐式转换类型System.Collections.Generic.IEnumerable <>为bool

我究竟做错了什么?

pwa*_*was 6

也许Any而不是Where返回其他集合(过滤)?

if (submitAnswersResponseRootObject.Response.SubmitAnswersResult.Prompts.prompt.Any(p=>p.code == 7101))
Run Code Online (Sandbox Code Playgroud)