I am trying to learn about NumberFormatInfo.NegativeSign Property, and put in the following code in VS.
CultureInfo ci = CultureInfo.CreateSpecificCulture ("");
ci.NumberFormat.NegativeSign = "\u203E";
double[] numbers = { -1.0, -16.3, -106.35 };
foreach (var number in numbers)
Console.WriteLine (number.ToString (culture));
Since I got a number of errors, I modified it to...
System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture ("");
ci.NumberFormat.NegativeSign = "\u203E";
double[] numbers = { -1.0, -16.3, -106.35 };
foreach (var number in numbers)
Console.WriteLine (number.ToString (ci));
And it compiled fine. But the output was:
?1
?16.3
?106.35
I got the code from .Net library framework definitions on Microsoft page here and the Unicode was supposed to change the negative sign to the OVERLINE character. Did I do anything wrong? Why am I getting the "?" sign instead?
I did not know about the console output configuration requirement. Thanks. One other item; the original code used culture instead of ci in the last line. I assumed that was a typo and changed it. I hope I was not wrong. The following are the lines they have:
CultureInfo ci = CultureInfo.CreateSpecificCulture ("");
ci.NumberFormat.NegativeSign = "\u203E";
double[] numbers = { -1.0, -16.3, -106.35 };
foreach (var number in numbers)
Console.WriteLine (number.ToString (culture));
I tried to post a question today, I got a message that I may lose access to the this site. I have no idea who or how evaluates the content of a question. I am also not sure why I receive this prompt when there was not negative feedback on any of my questions. None of the questions asked were redundant, and they met the guidelines provided on the site.