score:19

Accepted answer

borrowing a similar solution form here:

string[] result = {"hello there", "héllo there","goodbye"};

string word = "héllo";

var compareinfo = cultureinfo.invariantculture.compareinfo;

var filtered = result.where(
      p => compareinfo.indexof(p, word, compareoptions.ignorenonspace) > -1);

score:-1

you want to use the stringcomparison.invariantcultureignorecase enum.

source https://msdn.microsoft.com/en-us/library/system.stringcomparison(v=vs.110).aspx

filtered = result.contains(word, stringcomparison.invariantcultureignorecase);

however this is only going to work with linqtoobject. if you are using linqtosql or linqtoentityframework or linqtonhibernate, this will not work.


Related Query

More Query from same tag