convert 0.5 to 0.50 in C#

Posted by Rohit on Stack Overflow See other posts from Stack Overflow or by Rohit
Published on 2010-06-08T07:06:50Z Indexed on 2010/06/08 7:12 UTC
Read the original article Hit count: 278

Filed under:

I have a string which holds 0.5. I have to convert in to 0.50.

I have tried following ways but nothing works.Please help

hdnSliderValue.Value is 0.5,I want workFlow.QualityThresholdScore to be 0.50

workFlow.QualityThresholdScore = Convert.ToDecimal(String.format("{0:d}",hdnSliderValue.Value));

workFlow.QualityThresholdScore = Convert.ToDecimal(String.format("{0:0.00}",hdnSliderValue.Value));

IS there any built in function or will i have to do string handling to accomplish this.

© Stack Overflow or respective owner

Related posts about c#