这是我的有效代码:
foreach (var r in rlist)
{
if (r.IndexOf("_") != -1)
{
int id = int.Parse(r.Split('_')[1]);
var x_tmp = (from x in db.tblX where x.x_id == my_id && x.x_id == id select x).First();
x_tmp.order = someNumber;
}
}
db.SaveChanges();
有没有办法重构这个?