例:select * from table where name in(a,b,c,d);
中的a,b,c,d写成
pulbic class WhereName
{
public string name{ get; set; }
}
List<WhereName> ListWhere = new List<WhereName>();
ListWhere .Add(new WhereName{ name='a'});
ListWhere .Add(new WhereName{ name='b'});
ListWhere .Add(new WhereName{ name='c'});
在linq中
var r = from p in table
from n in ListWhere
where p.name == n.name
select p;
当然这只是我的想法,都是手打的,里面有可能有语法错误!