###,###,###,# #0
#是如果有数字的话就显示, there is no number of words is empty, 0 is if there is a number of words on display, no number is displayed as 0.
EG:
public string getformatestring (int Precision, double number)
{
string text = "###,###,###,# #0.";
for (int i = 0; i < Precision i++)
{
text = "0";
}
return number.tostring (text);
In the example above, the string that you say you want to format is output according to the precision (Precision), quantity (number) passed in by the function, where the for loop is the number of zeros after stitching the decimal point, which is zero placeholder.
This paper url:http://www.bianceng.cn/programming/csharp/201410/45584.htm
Debugging through breakpoints, visible, as shown in the following figure:
The parameters passed in at the time of the call are:
MessageBox.Show (getformatestring (10,2.0));
The output results are:
For content with custom numeric format strings, you can view the MSDN Web site: Click to open the link