我需要让 endResult 按 ID 降序排列,并且不确定它如何与 c# Linq 一起使用。任何帮助都会很棒。
private void textBox6_Leave(object sender, EventArgs e)
{
DataClasses3DataContext db = new DataClasses3DataContext();
int matchedAdd = (from c in db.GetTable<prop>()
where c.streetNum.Contains(textBox1.Text) && c.Direction.Contains(textBox2.Text) && c.street.Contains(textBox4.Text) && c.SUFF.Contains(textBox6.Text)
select c.ID).Single();
var before = (from c in db.GetTable<prop>()
where c.ID < matchedAdd
orderby c.PARCEL descending
select c).Take(6);
var after = (from c in db.GetTable<prop>()
where c.ID > matchedAdd
orderby c.PARCEL
select c).Take(6);
var endResult = after.Concat(before);
dgvBRT.DataSource = endResult;
}