Wednesday 9 July 2014

Return Yes, No from Boolean instead of True, False

I recently needed to output Boolean values into an iTextSharp PDF document having them represented as Yes or No rather than True or False

Cue MSDN. This article Boolean Structure explains how to do this.

Here's a quick example:

bool JobDone = true;
string strJobDone = JobDone ? "Yes" : "No"; // Returns "Yes"

No comments: