Expression tree differences between C# and VB.Net

The / division operator works differently in C# and VB. In C# it adapts to the data types used, while VB always converts the operands to floating point values:

() => 1 / 2 becomes Expression.Divide(1, 2)
Function() 1 / 2 becomes Expression.Divide(Expression.Convert(1, Double), Expression.Convert(2, Double))

In VB you would need to use the \ operator for integer division and / for floating point division to get the same as the / operator in C#.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)