Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# only only 2 digits after decimal number double

decimalVar.ToString("#.##"); // returns ".5" when decimalVar == 0.5m
or

decimalVar.ToString("0.##"); // returns "0.5"  when decimalVar == 0.5m
or

decimalVar.ToString("0.00"); // returns "0.50"  when decimalVar == 0.5m
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #digits #decimal #number #double
ADD COMMENT
Topic
Name
3+9 =