var amount="0";
@String.Format("{0:0.00}", amount)
returns "0"
While I was expecting it to return
"0.00"
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Formatting a string will just return the string itself, you have to format a number to get it formatted as a number:
A variable with implicit type which is assigned an integer value will be an integer, so it won’t have a fractional part. You might want to specify the type:
Or use a double value: