Answer the question
In order to leave comments, you need to log in
How to execute query in Linq case insensitively?
Hello. I'm trying to make a request like:
string word = search_txbx.Text.;
ObservableCollection<Model.Game> games = _ViewModel.Games;
var query = from db in games
where db.name.Contains(word)
select db;
games_dgrd.ItemsSource = query;
Answer the question
In order to leave comments, you need to log in
Convert both components being compared to upper or lower case and compare.
Code with minimal changes to solve your problem
string word = search_txbx.Text.;
ObservableCollection<Model.Game> games = _ViewModel.Games;
var query = from db in games
where db.name.Contains(word, StringComparer.InvariantCultureIgnoreCase)
select db;
games_dgrd.ItemsSource = query;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question