Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Created Issue: Handling of StringComparison in string.Equals is inconsistent [841]

$
0
0
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");
}
}

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>