The following query ignores the stringcomparison setting, it executes the query but it is just a standard = operator:
foreach (var post in posts)
{
if (db.Posts.Any(x => post.Text.Equals("İ", StringComparison.InvariantCultureIgnoreCase)))
{
Console.WriteLine("Match");
}
}
If you use the static string.Equals, as below, then we throw.
foreach (var post in posts)
{
if (db.Posts.Any(x => string.Equals(x.Text, post.Text, StringComparison.InvariantCultureIgnoreCase)))
{
Console.WriteLine("Match");
}
}
foreach (var post in posts)
{
if (db.Posts.Any(x => post.Text.Equals("İ", StringComparison.InvariantCultureIgnoreCase)))
{
Console.WriteLine("Match");
}
}
If you use the static string.Equals, as below, then we throw.
foreach (var post in posts)
{
if (db.Posts.Any(x => string.Equals(x.Text, post.Text, StringComparison.InvariantCultureIgnoreCase)))
{
Console.WriteLine("Match");
}
}