How can I get .ToUpper() (or the equivalent) to work when using .Contains() in Linq to Sql?

Posted by quakkels on Stack Overflow See other posts from Stack Overflow or by quakkels
Published on 2011-01-03T19:52:17Z Indexed on 2011/01/03 19:53 UTC
Read the original article Hit count: 232

Filed under:
|
|
|

This code:

keyword = 's';
IEnumerable<Member> searchResults = (from m in members
                             where m.ScreenName.ToUpper().Contains(keyword.ToUpper())
                             select m).AsEnumerable();

Only returns records that have an uppercase 'S' in the ScreenName. Why is m.ScreenName.ToUpper() being ignored? How do I convert m.ScreenName to uppercase so I can perform case-insensetive checks?

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ