I know how to use .Contains for looking up '%testwords%', my question is about how开发者_如何学Python to use linq to get '%test%words%'. Thanks
maybe something like this if you're not using Linq to SQL:
var query = from o in yourObject
where o.field.Contains("test")
where o.field.Contains("words")
where o.field.indexOf("test") < o.field.indexOf("words")
select o;
if you are using Linq to SQL, use the SqlMethods that Stefanvds showed.
.Where(q => SqlMethods.Like(q,"%test%words%"))
use SqlMethods
well, i think the answer is NO :(
Probably the closest answer is lst.Where(foo.Contains("test") && foo.Contains("word")), though that statement doesnt give the right sequence as '%test%word%'
精彩评论