LIKE operator in LINQ

前端 未结 14 1119
一生所求
一生所求 2020-11-27 16:29

Is there any way to compare strings in a C# LINQ expression similar to SQL\'s LIKE operator?

Suppose I have a string list. On this list I want to search

14条回答
  •  旧巷少年郎
    2020-11-27 16:50

    Ideally you should use StartWith or EndWith.

    Here is an example:

    DataContext  dc = new DCGeneral();
    List lstPerson= dc.GetTable().StartWith(c=> c.strNombre).ToList();
    
    return lstPerson;
    

提交回复
热议问题