三元运算符 ||预定义类型 'System.ValueTuple`3' 未定义或未导入

ternary operator || Predefined type 'System.ValueTuple`3' is not defined or imported

private void Disable_Proxy_textboxes(bool v)
{
    v = !v;
    address_textbox.Enabled = v;
    port_textbox.Enabled = v;
    port_label.ForeColor = Color.FromArgb(v?(255,255,255):(100, 100, 100));
    address_label.ForeColor=v?(Color.FromArgb(255,255,255)):(Color.FromArgb(100,100,100));
}

在编写代码时,我决定尝试使用三元运算符,现在我真的很困惑为什么 port_label.ForeColor = Color.FromArgb(v?(255,255,255):(100, 100, 100)); 中会出现错误。我明白下一行是非常正确的,但为什么这一行显示以下错误:

Predefined type 'System.ValueTuple`3' is not defined or imported
cannot convert from '(int, int, int)' to 'int'  

文档只是说

Either the type of first_expression and second_expression must be the same, or an implicit conversion must exist from one type to the other.

在我的例子中,这两种数据类型是不是不一样?这两种情况和这个例子不一样吗?

bool c=a?true:false;
a?(c=true):(c=false);

我不明白的是什么。也请这不是其中之一为什么这段代码不起作用,我在这里不要求任何调试。谢谢。

不是条件运算符的问题,两边都是ValueTuple`3类型。所以条件运算符 ? returns a ValueTuple`3.

但是 Color.FromArgb 的重载没有将 ValueTuple`3 作为参数。

编译器不会将 ValueTuple`3 解构为您打算使用的重载的三个 int 参数。