Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: BindRound method binds nullable double as decimal [1580]

$
0
0
BindRound method binds nullable double as decimal.
```
private Expression BindRound(SingleValueFunctionCallNode node)
{
Contract.Assert("round" == node.Name);

Expression[] arguments = BindArguments(node.Parameters);

Contract.Assert(arguments.Length == 1 && IsDoubleOrDecimal(arguments[0].Type));

MethodInfo round = arguments[0].Type == typeof(double) ? ClrCanonicalFunctions.RoundOfDouble : ClrCanonicalFunctions.RoundOfDecimal;
return MakeFunctionCall(round, arguments);
}
```

Comments: This does not seem to work. Msdn's example compares a variable to a type using "is". However, here we compare 2 types. ``` int? i = 5; if (i is int) // true ``` A solution is: ``` MethodInfo round = IsType<double>(arguments[0]) ? ClrCanonicalFunctions.RoundOfDouble : ClrCanonicalFunctions.RoundOfDecimal; ```

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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