我不明白为什么代码 A 正确而代码 B 不正确:
代码 A
IEnumerable<decimal> loanQuery =
from amount in loanAmounts
where amount % 2 == 0
orderby amount
select ascending amount //this line
代码 B(不正确)
IEnumerable<decimal> loanQuery =
from amount in loanAmounts
where amount % 2 == 0
select amount
orderby ascending amount
由于很多人回答不正确,我现在发布了正确的代码:
IEnumerable<decimal> loanQuery =
from amount in loanAmounts
where amount % 2 == 0
orderby amount ascending
select amount