I am using string.Format in a razor view to format items coming from my viewModel.
It is working fine when I use it like this:
<td>
<b>@string.Format("{0:c}", item.TotalCreditPaid)</b>
</td>
But, when I try to use it within an if statement it is not displaying anything in the view:
<td>
<b>@if (item.AverageTimeToPay != null)
{
string.Format("{0} Days", item.AverageTimeToPay);
}
</b>
</td>
I stepped through it and the if is being hit, the item.AverageTimeToPay has a value of 12, but it is not displaying anything.
Any idea why this is happening? Thanks!