Dav*_*vid 3 c# wpf performance ternary-operator
我想知道:这两个版本之间的性能最佳指令是什么:
Background = Application.Current.Resources[condition ? BackgroundName1 : BackgroundName2] as Brush;
Run Code Online (Sandbox Code Playgroud)
和:
Background = condition ? Application.Current.Resources[BackgroundName1] as Brush : Application.Current.Resources[BackgroundName2] as Brush;
Run Code Online (Sandbox Code Playgroud)
有什么不同吗?如果是,哪一个更好?
谢谢
注意:BackgroundName1和2只是字符串
| 归档时间: |
|
| 查看次数: |
459 次 |
| 最近记录: |