Nicholas Paldino said:
You can create an instance of the NumberFormatInfo class, and set the
PositiveSign property to "+". When you use this format info (or another
with this property modified), it should print out positive numbers with a
plus.
Hmm.., well let's have a look at the following fragment:
NumberFormatInfo nfi = new NumberFormatInfo();
nfi.PositiveSign = "#";
double d = Double.Parse(" #12.34", NumberStyles.Any, nfi);
Console.WriteLine("d = {0:F}", d);
string w = d.ToString(nfi);
Console.WriteLine(w);
If I understand you right, you expect the parsing ok
and the output to be #12.34. This would be fine for me,
but it is /not/ the case. The parsing is indeed ok,
but the output is 12.34.
And this behaviour is what the documentation announces:
PositiveSign. Hinweise: Diese Eigenschaft wird nur für
das Analysieren numerischer Zeichenfolgen, nicht für
deren Formatierung verwendet. (German ;-)
So I have not yet found the solution (besides doing
the formatting by myself, of course).
Thanks. Peter