I don’t know the length of Russell F’s commute. Presumably, the distance is measured in miles. Miles and miles. I say that, because of this block, which is written… with care.
string Miles_w_Care = InvItem.MilesGuaranteeFlag == true && InvItem.Miles_w_Care.HasValue ? (((int)InvItem.Miles_w_Care / 1000).ToString().Length > 2 ? ((int)InvItem.Miles_w_Care / 1000).ToString().Trim().Substring(0, 2) : ((int)InvItem.Miles_w_Care / 1000).ToString().Trim()) : " ";
string Miles_wo_Care = InvItem.MilesGuaranteeFlag == true && InvItem.Miles_wo_Care.HasValue ? (((int)InvItem.Miles_wo_Care / 1000).ToString().Length > 2 ? ((int)InvItem.Miles_wo_Care / 1000).ToString().Trim().Substring(0, 2) : ((int)InvItem.Miles_wo_Care / 1000).ToString().Trim()) : " ";
Two lines, so many nested ternaries. Need to round off to the nearest thousand? Just divide and then ToString
the result, selecting the substring as needed. Be sure to Trim
the string which couldn’t possibly contain whitespace, you never know.
Ironically, the only expression in this block which isn’t a WTF is InvItem.MilesGuaranteeFlag == true
, because while we’re comparing against true
, MilesGuaranteeFlag
is a Nullable<bool>
, so this confirms that it has a value and that the value is true.
So many miles.
And I would write five hundred lines
and I would write five hundred more
just to be the man who wrote a thousand lines
Uncaught Exception at line 24