I have the following code:
ContactList = ContactList.FindAll(p => p.DeptName.StartsWith(optAlpha.SelectedItem.Value)).ToList();
If DeptName="test"
and optAlpha.SelectedItem.Value="T"
, it doesn't work.
I tried with the following code, still doesn't work.
ContactList = ContactList.FindAll(p => p.DeptName.ToLower().StartsWith(optAlpha.SelectedItem.Value.ToLower())).ToList();
Just use
StartsWith(optAlpha.SelectedItem.Value, StringComparison.InvariantCultureIgnoreCase);
and it will ignore the case during the default comparison.