當我編譯我的C#項目在MonoDevelop中,我得到以下錯誤:類型條件表達式不能被確定爲
Type of conditional expression cannot be determined as 'byte' and 'int' convert implicitly to each other
代碼段:
byte oldType = type;
type = bindings[type];
//Ignores updating blocks that are the same and send block only to the player
if (b == (byte)((painting || action == 1) ? type : 0))
{
if (painting || oldType != type) { SendBlockchange(x, y, z, b); } return;
}
這是行在錯誤中突出顯示:
if (b == (byte)((painting || action == 1) ? type : 0))
非常感謝幫助!
這是有道理的。非常感謝你! – Jakir00 2011-04-02 18:16:56
如果參數預期爲任何類型,例如String.Format(「value:{0}」,(value == null)?:「null」:value),那麼該怎麼辦?where value is type '詮釋?'? – mr5 2017-05-03 08:32:06