日期:2014-05-20  浏览次数:20817 次

linq经验集合

整理中。。。。。

1.多id查询

var queryable = from c in this.db.NewsInfo where "9,10,11,12,13".Split(',').Contains(c.SmallId) orderby c.id descending select c;

?2.linq 简单操作datatable

var result1 = (from row in datatable.AsEnumerable()
???????????????????select row["c1"].ToString()).ToList();
?
result1.AddRange(
????????????????????????????? (from row2 in datatable.AsEnumerable()
??????????????????????????? ?select row2["c2"].ToString()).toArray()
??????????????????????????? );
?
string[] arrays = result1.ToArray();

?