이 항목이 있으며 기간은 2 일 때 원하는 항목을 선택할 수 있습니다.하지만 기간 2가 없으면 기간 3을 선택하려고합니다. 방법?특성이 x 인 경우 하위 항목을 선택하고 속성이 y를 선택하십시오.
.Where(node => (string)node.Attribute("period") == "2" || (string)node.Attribute("period") == "3")
:
return document.Descendants("time")
.Where(node => (string)node.Attribute("period") == "2")
.Take(5)
.Select(status => WeatherFactory.Create(status, city, pos))
.ToList();
이것 하나의 쿼리? –