Ron*_*omb 68 c# lambda enums roslyn c#-6.0
在尝试Visual Studio 2015 RC时,我收到了以前正在运行的代码的运行时错误.给定(x => x.CustomerStatusID == CustomerStatuses.Active)
作为a传递给函数的lambda Expression<>
,调试器在表达式树中显示差异.以前编译为:
.Lambda #Lambda1<System.Func`2[Services.DataClasses.CustomerDC,System.Boolean]>(Services.DataClasses.CustomerDC $x)
{
(System.Int32)$x.CustomerStatusID == 0
}
Run Code Online (Sandbox Code Playgroud)
但是在C#6.0中它现在编译为
.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)
}
Run Code Online (Sandbox Code Playgroud)
虽然我的树遍历代码的修复是直截了当的,并且额外的细节是值得赞赏的,有没有人知道任何其他陷阱漂浮这样?
或者,是否有人链接到有关如何改进重载决策的细节的信息?我找不到任何东西.
归档时间: |
|
查看次数: |
1954 次 |
最近记录: |