I have little confusion in understanding, how the format is being generated for the following line.
Could any one provide me , how its renders the value in Format, With appropriate commas, being put at the right places in the figure.
writer.Write(string.Format("Your Estimated Loan Paymement+will be {0:$#,##0.00;($#,##0.00);Zero}", + this.calcPayment(this._pv,1,2) ));
Here calcPayment() is a function returns a numeric value. For example if it returns 2000.33, then it is outputed as $2,003.33.
I know it is doing the formating, but how?
Thank you.
Breaking down the format string:
{0:$#,##0.00;($#,##0.00);Zero}There are 3 groups:
$#,##0.00– used when the argument (this.calcPayment(this._pv,1,2)in this case) is positive.
($#,##0.00)– used when arg is negativeZero– used when arg is zero#is a digit placeholder and0is a zero placeholder (padding).See this for more information.