3
I’m having some difficulty limiting the decimal places in C# .
double x = 1,41293
I wanted to output only from 1.412
I have tested the following code:
Convert.ToDecimal(x).ToString("0.00", CultureInfo.InvariantCulture)
and
Convert.ToDecimal(x).ToString("N3", CultureInfo.InvariantCulture)
change the comma by a point:
double x = 1.41293
– Rovann Linhalis
@Rovannlinhalis I can’t do that, that’s why I use Cultureinfo.Invariantculture
– Pedro Azevedo
This is from C#, which like other programming languages use . as decimal separator, including this first line, will give compilation error, unless it is a string
– Rovann Linhalis
But I can’t change that point
– Pedro Azevedo