我有这段代码:
return Ok(new
{
Answer = (string) null,
Text = question.Text,
Answers = question.Answers.Select((a, i) => new
{
AnswerId = a.AnswerId,
AnswerUId = i + 1,
Correct = (bool?) null,
Response = (bool?) null,
Text = a.Text
})
});
如何订购AnswerId返回的答案?
答案 0 :(得分:3)
添加
.OrderBy( z => z.AnswerId)
紧接在Select语句之后。