How to use Linq to check if a list of strings contains any string in a list

后端 未结 5 1622
别跟我提以往
别跟我提以往 2021-02-05 07:12

I\'m constructing a linq query that will check is a string in the DB contains any of the strings in a list of strings.

Something like.

query = query.Whe         


        
5条回答
  •  臣服心动
    2021-02-05 07:37

      var t = new List { "a", "b", "c" };
    

    var y = "a b d";

    var res = y.Count(x => t.Contains(x.ToString()));

提交回复
热议问题