Hi Gismo,
Just to double check I ran this on my N2P running NetMF 4.3, 1
I replaced LCD.Write with Debug.Print
@KiwiBryn
blog.devmobile.co.nz
public static void Main()
{
double myDouble = 22.503456785478;
string[] formats = new string[] { "", "f2", "g2", "n2", "d2", "0.00", "N2" };
for (int i = 0; i < formats.Length; i++)
{
Debug.Print(formats[i] + ": " + myDouble.ToString()); //22.50 expected result
Thread.Sleep(1000);
}
}
Displayed ( as expected as format string not specified)
: 22.503456785478001
f2: 22.503456785478001
g2: 22.503456785478001
n2: 22.503456785478001
d2: 22.503456785478001
0.00: 22.503456785478001
N2: 22.503456785478001
The thread '<No Name>' (0x1) has exited with code 0 (0x0).
Then "fixed" version (I had to remove 0.00 as it was unsupported)
public static void Main()
{
double myDouble = 22.503456785478;
string[] formats = new string[] { "", "f2", "g2", "n2", "d2", "N2" };
for (int i = 0; i < formats.Length; i++)
{
Debug.Print(formats[i] + ": " + myDouble.ToString(formats[i]));
Thread.Sleep(1000);
}
}
DIsplayed
: 22.503456785478001
f2: 22.50
g2: 22.503456785478001
n2: 22.50
d2: 22.50
N2: 22.50
The thread '<No Name>' (0x1) has exited with code 0 (0x0).