I have the following in a razor view:
<td>@payments.Sum(p => p.Amount)</td>
I want it to display as a currency so have '$' and two decimals on the end.
I think normally you go something like {0:C}.
I don't know how to incorporate this into what I've got as the Sum does not have an overload for format.
Do I need to do this with a css class?
You would do this:
<td>@String.Format("{0:C}", payments.Sum(p => p.Amount))</td>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With