Recently, I read about C# three part display format in this article: https://diptimayapatra.wordpress.com/2014/01/13/3-part-format-of-numbers-in-c/
The 3 part format is used to show a positive, negative and zero value number. The string format has three parts. The first part corresponds to the positive test and the second part corresponds to negative test. The last part is for when the value is zero.
The result of this will be "(+) 29.12"
double value1 = 29.12;
string formattingString = $"(+) #.##; (-) #.##; No value provided";
Console.WriteLine(value1.ToString(formattingString));
The result of this will be "positive"
double value1 = 29.12;
string formattingString = $"positve; negative; No value provided";
Console.WriteLine(value1.ToString(formattingString));
But the result of this is "2929.12". Why is this so?
Based on above logic, i expect that the result should be 29.12but it ends up becoming 2929.12. Why using . inside will become this unpredictable output?
double value1 = 29.12;
string formattingString = $"29.12; Negative; No value provided";
Console.WriteLine(value1.ToString(formattingString));