Floating Point fixed length Number formatting c#
问题 I want to format a floating point number as follows in C# such that the entire width of the floating point number in C# is a fixed length (python equivalent format specifier 6.2f) I do NOT want it to be padded with 0's on the left but padded with a white space 100.00 90.45 7.23 0.00 what I have tried so far string.Format({0:###.##},100); string.Format({0:###.##},90.45); string.Format({0:###.##},7.23); string.Format({0:###.##},0.00); but the output is incorrect 100 90.45 7.23 //nothing is