小编Meh*_*lak的帖子

三元运算符行为不一致

以下表达式是可以的

short d = ("obj" == "obj" ) ? 1 : 2;
Run Code Online (Sandbox Code Playgroud)

但是当您像下面一样使用它时,会发生语法错误

short d = (DateTime.Now == DateTime.Now) ? 1 : 2;
Run Code Online (Sandbox Code Playgroud)

无法将类型'int'隐式转换为'short'.存在显式转换(您是否错过了演员?)

任何人都可以解释为什么会这样吗?

在三元运算符中比较字符串到字符串和datetime到datetime之间有区别吗,为什么?

如果你能帮助我,我将不胜感激.

c# int casting short conditional-operator

51
推荐指数
2
解决办法
1535
查看次数

是否可以在不同的TFS服务器之间进行合并或分支?

我想将我的解决方案分支到使用TFS 2010的不同TFS服务器.

有没有办法做到这一点?

version-control visual-studio-2010 tfs2010

6
推荐指数
1
解决办法
2379
查看次数