Linq
通用查询方法
查询数据是否存在
collection.Where(x=>x.age > 15).Any()
not in/in 写法
List<int> count = new List<int>(){11,31,12}
var result = from x in db.table
where count.Contains(x.id)
select x;
多表连接Join in on
var result = from t from _ctx.tableA
join x in _ctx.tableB on t.id equals x.sid
where x.id=1
select t
Lambda
通用查询方法
排序
1.Lambda表达式:
array.Sort((x, y) => int.Parse(x).CompareTo(int.Parse(y)));
2. 委托:
array.Sort(delegate (string p1, string p2)
{
return int.Parse(p1).CompareTo(int.Parse(p2));
});