Case insensitive string compare with linq-to-sql and linq-to-objects

前端 未结 3 1949
野性不改
野性不改 2021-01-17 21:18

see also Differences between LINQ to Objects and LINQ to SQL queries

We are using the some queries over our database and our

3条回答
  •  孤独总比滥情好
    2021-01-17 21:50

    Here are the list of supported string operations in LINQ to SQL, which would obviously work in LINQ to objects: http://msdn.microsoft.com/en-us/library/bb882672.aspx

    I personally haven't evaluated each for performance, but ToLower and ToUpper aren't supported in LINQ to SQL, so it seems like Compare is a good candidate. You can explore the translated SQL by using a tool like LINQPad, which has a free version and translates a query into database SQL, and see how it runs against the DB.

    Also, LINQ to Objects probably differs so what's good for one may not be good for the other...

提交回复
热议问题