Try to search your question here, if you can't find : Ask Any Question Now ?

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

HomeCategory: stackoverflowternary operator || Predefined type 'System.ValueTuple`3' is not defined or imported
Avatarwillson asked 2 weeks ago
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));
}

While coding I decided to play around the ternary operators and now am really confused why there is an error in port_label.ForeColor = Color.FromArgb(v?(255,255,255):(100, 100, 100));. I understand that the next line is very correct but why does this specific line show the following errors:

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

The docs just say

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.

So are both the data types not the same in my case? Are both the cases not same as this example?

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

What is it that I am not understanding. Also please this is not one of those why is this code not working, I am not asking any debugging here. Thanks.

1 Answers
Best Answer
AvatarJyoti answered 2 weeks ago
Your Answer

0 + 6 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com