我如何加入到这样的顺序由第二个项目? 我想通过一个goalsScored元订购了。
VAR theteams =
(从团队xdoc.Descendants(小组)
排序依据(INT)teams.Element(分)降
选择
新的团队(teams.Element(teamID),价值,
(INT)teams.Element(分))
)。取(3);
但thenby似乎并不插槽来此查询。
解决方案 VAR theteams =
(从团队xdoc.Descendants(小组)
排序依据(INT)teams.Element(分)递减,OtherField1,OtherField2
选择新的团队(teams.Element(teamID),价值,
(INT)teams.Element(分)))以(3);
How do I add a second item to order by with this? I want to order by a goalsScored element too.
var theteams =
(from teams in xdoc.Descendants("team")
orderby (int)teams.Element("points") descending
select
new Team(teams.Element("teamID").Value,
(int)teams.Element("points"))
).Take(3);
but thenby doesn't seem to slot in to this query.
解决方案var theteams =
(from teams in xdoc.Descendants("team")
orderby (int)teams.Element("points") descending, OtherField1, OtherField2
select new Team(teams.Element("teamID").Value,
(int)teams.Element("points"))).Take(3);