I need to compare binary values in a query done by Linq2sql.
table1.FirstOrDefault(r => r.ID.SequenceEqual(id))//ID and id are binary/byte[].
but Linq2sql is throwing an exception because SequenceEqual
cannot be executed in it because it's not defined for SQL.
I found this answer which creates a new Compare
method to confuse Linq into allowing it.
But then I found that ==
works as well since SQL compares binaries byte-by-byte anyway.
But since I saw that answer which didn't bring this simple solution, I was wondering if it will really work all the time.
So, is there any pitfall I'm missing here?