I have a lambda expression:
var masterDocs = GetMasterDocs(new TNGService.TngServiceClient());
var searchStr = txtDocSearch.Text;
var filtered = masterDocs.Where(i => i.DisplayTitle.Contains(searchStr));
lbxDocuments.DataSource = filtered;
lbxDocuments.DataBind();
For some reason it is not returning expected results. For instance, there is a DisplayTitle that contains the word “Orifice” but when I run this expression, nothing is returned. Am I going about this the wrong way?
The
Containsmethod is case sensitive. Can it be that your input and comparison differs in casing? To get around that, you can useIndexOfinstead: