Click here to Skip to main content
15,914,010 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
this.EasyMoneyMarathi.SetParameterValue("Display_Normal_cashflow", (object)(bool) (Display_Normal_cashflow ? 1 : 0));
Posted
Updated 28-May-15 0:27am
v2
Comments
Andy Lanng 28-May-15 6:26am    
You start will a boolean
You output an int based on that boolean
you try to cast the int back to a boolean
and then you cast that as an object.

No - you cannot convert an int to a boolean
Maciej Los 28-May-15 6:31am    
Are you sure, Andy?
Test it:
int input = 5;
bool output = input==1 ? true : false;
Andy Lanng 28-May-15 6:50am    
You can output whatever you like like from an if statement but the cast won't work.

And you code is pointless. Why not just bool output = input==1

The input==1 is a Boolean operand. The result is a boolean. Display_Normal_cashflow must also be a boolean as it is used as the condition of the inline if.
Maciej Los 28-May-15 6:31am    
What kind of value returns Display_Normal_cashflow?
Richard MacCutchan 28-May-15 7:00am    
Fairly obviously (from the inline if/else) it's a boolean value.

Why not this:
C#
this.EasyMoneyMarathi.SetParameterValue("Display_Normal_cashflow", Display_Normal_cashflow);
 
Share this answer
 
Comments
Andy Lanng 28-May-15 6:52am    
I was kinda hoping he would figure that out himself :S
Richard MacCutchan 28-May-15 6:57am    
Judging by what he wrote I don't think there is much chance. It's the same as all the people who use conversions and ToString's unnecessarily, no real idea what they are doing.
CPallini 28-May-15 7:15am    
Agreed.
My 5.
Sergey Alexandrovich Kryukov 28-May-15 11:42am    
Sure, a 5.
—SA
this.EasyMoneyMarathi.SetParameterValue("Display_Normal_cashflow", (object)Display_Normal_cashflow); 


or just this

this.EasyMoneyMarathi.SetParameterValue("Display_Normal_cashflow", Display_Normal_cashflow); 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900