Linq StartsWith Case Senstive

  • Thread starter Thread starter Stuart Shay
  • Start date Start date
S

Stuart Shay

Hello All

I have the following LINQ Query how can I evaluate that the text evaluated
is either upper or lower case.

userList = userList.Where(UserAdministrationModel =>
UserAdministrationModel.LastName.StartsWith(ViewState["SearchText"].ToString()));

Thanks
Stuart
 
Hello All

I have the following LINQ Query how can I evaluate that the text evaluated
is either upper or lower case.

userList = userList.Where(UserAdministrationModel =>
UserAdministrationModel.LastName.StartsWith(ViewState["SearchText"].ToString()));

Thanks
Stuart

The StartsWith method has an overload that allows you to specify a
case insensitive compare. Have you tried those?

Chris
 
Chris:

Thanks Got it to work using .ToUpperInvariant()

userList = userList.Where(UserAdministrationModel =>
UserAdministrationModel.LastName.ToUpperInvariant().StartsWith(ViewState["SearchText"].ToString().ToUpperInvariant()));

Best
Stuart



Chris Dunaway said:
Hello All

I have the following LINQ Query how can I evaluate that the text
evaluated
is either upper or lower case.

userList = userList.Where(UserAdministrationModel =>
UserAdministrationModel.LastName.StartsWith(ViewState["SearchText"].ToString()));

Thanks
Stuart

The StartsWith method has an overload that allows you to specify a
case insensitive compare. Have you tried those?

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Linq Dynamic Columns 1
Linq. Why do I get this error? 2
Problem in linq. 9
Convert type 'int?[]' to 'int[]' 7
Linq. String 5
Linq > Group 2
Compare Strings in Linq. Need advice ... 4
isolate text within a string? 4

Back
Top