I'm actually trying to answer this question but as that's very involved and unlikely to get a good response quickly, I'm going to try and work out the implementation myself. The fundamental problem seems to be that the C# example I was following doesn't translate directly to VB.
When examining a String comparison BinaryExpression
in a lambda, VB reports the Expression.Method.DeclaringType
to be Microsoft.VisualBasic.CompilerServices.Operators
with a method name of CompareString
. This is clearly VB-specific.
The Expression is just comparing x.Content_Type <> ""
and calling ToString on it returns {(CompareString(x.Content_Type, "", False) != 0)}
- which seems pretty logical (CompareString docs here).
Can someone explain to me how (or even better, why) VB and C# handle string comparisons differently.
I think if I can get an answer to that, I should be able to work out a solution to the other problem.
Edit:
To clarify, I'm implementing a custom LINQ provider which is examining the following Where
call:
Query.Where(function(x) x.Content_Type <> "")
or the C# equivalent...
query.Where(x=>x.Content_Type!="");
As far as I'm aware, the 2 should be functionally identical