有人可以向我解释以下编译器问题吗
错误:无法确定条件表达式的类型,因为 'string' 和 'int' 之间没有隐式转换
// WORKS
string text = string.Format(
"the id is {0}", _Obj.Id.ToString());
// WORKS, without implicit conversion <<<
string text = string.Format(
"the id is {0}", _Obj.Id);
// WORKS
string text = string.Format(
"the id is {0}", (_Obj == null) ? "unknown" : _Obj.Id.ToString());
// NO WAY <<<
string text = string.Format(
"the id is {0}", (_Obj == null) ? "unknown" : _Obj.Id);
在最后一个示例中,也没有隐式转换。