How to do a LIKE query with linq?

前端 未结 8 1576
予麋鹿
予麋鹿 2020-12-03 02:57

How can i perform an LIKE query within Linq?

I have the following query i would like to execute.

var results = from c in db.costumers
              w         


        
8条回答
  •  离开以前
    2020-12-03 03:22

    You can use contains:

    string[] example = { "sample1", "sample2" };
    var result = (from c in example where c.Contains("2") select c);
    // returns only sample2
    

提交回复
热议问题