I am querying a table using Entity Framework. The first bit of code was what I wrote, the second bit was that ReSharper suggested that I reorganize it too. The first of these gracefully returns zero if it does not exist, but the second throws an exception.
This was done using records 0-1 in the table (all columns are marked as NOT NULL)
Code that works:
context.brandlink.FirstOrDefault(x => x.ManufacturerKey.ToLower() == manufacturerKey.ToLower());
and code that doesn't work:
context.brandlink.FirstOrDefault(x => String.Equals(x.ManufacturerKey, manufacturerKey, StringComparison.InvariantCultureIgnoreCase));
Exception thrown:
The number of arguments provided to call the 'Boolean Equals (System.String, System.String, System.StringComparison)' method is incorrect
So my question is: what is the difference between the two expressions?
source share