我在我的应用程序中使用了List<string> contains = new List<string>() { "Poland", "Ecuador" };
List<object> array = new List<object>();
array.Add("Austria");
array.Add("Eritrea");
array.Add(contains);
//this works
var data0 = Contact.GetContactsList().AsQueryable().Where("@0.Contains(outerIt.Country)", array);
//this does not work
var data = Contact.GetContactsList().AsQueryable().Where("Country.Equals(@0) OR it.Country.Equals(@1) OR @3.Contains(outerIt.Country)", array.ToArray());
,但遗憾的是它无效。
这是我的示例代码。
data0
我有与国家/地区相关的联系人列表。
你可以看到我使用了混合运算符,即equals和contains。
如果单独使用contains,那么它的工作正确。
我试图在这里做新事物,使用Equals和Contains运算符是相同的查询字符串。
我已经附加了描述输出的图像或data
以及处理以获取<div class="container">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<div class="row">
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/1.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/2.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/3.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/4.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/5.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/6.jpg" alt="Image" /></a>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/7.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/8.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/9.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/10.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/11.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/12.jpg" alt="Image" /></a>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/13.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/14.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/15.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/16.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/17.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/18.jpg" alt="Image" /></a>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/19.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/10.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/11.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/12.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/13.jpg" alt="Image" /></a>
</div>
<div class="col-md-2">
<a href="#" class="thumbnail">
<img src="Images/14.jpg" alt="Image" /></a>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
谢谢。
答案 0 :(得分:0)
附上结果。