c# - Enums in lambda expressions are compiled differently; consequence of overload resolution improvements? -


while trying out visual studio 2015 rc, received run-time error on working code. given lambda (x => x.customerstatusid == customerstatuses.active) passed function expression<>, debugger shows difference in expression tree. formerly compiled this:

.lambda #lambda1<system.func`2[services.dataclasses.customerdc,system.boolean]>(services.dataclasses.customerdc $x) {     (system.int32)$x.customerstatusid == 0 } 

but in c# 6.0 compiles

.lambda #lambda1<system.func`2[services.dataclasses.customerdc,system.boolean]>(services.dataclasses.customerdc $x) {     (system.int32)$x.customerstatusid == (system.int32).constant<services.dataclasses.customerstatuses>(active) } 

although fix tree-traversing code straightforward , additional detail appreciated, know of other gotchas floating around this?

alternately, have link information on specifics of how overload resolution improved? cannot find any.

this has nothing overload resolution. previous compiler prematurely optimized right-hand-side of comparison, thereby omitting code corresponding source expression.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -