Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linq 林克要有;在;类似SQL的子句_Linq_Linq To Sql - Fatal编程技术网

Linq 林克要有;在;类似SQL的子句

Linq 林克要有;在;类似SQL的子句,linq,linq-to-sql,Linq,Linq To Sql,我想在linq中这样做: SQL:从客户所在城市(“柏林”、“伦敦”、“马德里”、“伯尔尼”、“格拉茨”)中选择 我有一个字符串,如下所示: string city ="'Berlin','London','Madrid','Bern','Graz'" var query = from c in Customers where c.City ==?? select c; 字符串变量将更改 非常感谢。好的,我发现 string[] city2 =

我想在linq中这样做: SQL:从客户所在城市(“柏林”、“伦敦”、“马德里”、“伯尔尼”、“格拉茨”)中选择

我有一个字符串,如下所示:

string city ="'Berlin','London','Madrid','Bern','Graz'"
var query = from c in Customers 
            where c.City ==??
            select c;
字符串变量将更改

非常感谢。

好的,我发现

string[] city2 = { "Berlin", "London", "Madrid", "Bern", "Graz" };
var query2 = from c in Customers
            where city2.Contains(c.City)
            select c;

这回答了你的问题吗?