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
 
Back
Top