[RESOLVED] Can someone tell me what's wrong with this.
I'm using VS2010 C#4.0
Code:
if (resultTable.Rows[i]["RISKADDRESS"].ToString().EndsWith(",") ? riskAddress = resultTable.Rows[i]["RISKADDRESS"].ToString().Substring(0, resultTable.Rows[i]["RISKADDRESS"].ToString().Length - 1) : riskAddress = resultTable.Rows[i]["RISKADDRESS"].ToString());
it states that cannot implicitly convert from string to bool
If I enter the above long hand i.e. with a full if else statement I receive no errors.
If I take the first part
Code:
resultTable.Rows[i]["RISKADDRESS"].ToString().EndsWith(",")
and wrap it in a Convert.ToBoolean or prefix with (Boolean), I still receive the error.
The inline condition EndsWith needed to be ',' as opposed to ","