2
I have in my app.config
the following code:
<add key="FolhaA4" value="0.168056514197457, 6.36413684210526"/>
And here the method to get these key values:
private double[] ObterValoresConfiguracao(string chave)
{
Manager.Configuration config = Manager.ConfigurationManager.OpenExeConfiguration(this.GetType().Assembly.Location);
Manager.AppSettingsSection app = (Manager.AppSettingsSection)config.GetSection("appSettings");
string[] valor = app.Settings[chave].Value.Split(',');
return valor.Select(i => Convert.ToDouble(i)).ToArray();
}
I’m retrieving them as string and converting to double
, I just need those values to be doubles
in the same way as they are, and in the conversion is returning totally different values.
Ex: 6.36413684210526
converts to -> 6364136842105.26
Does anyone know why of this? how do I convert the number to double
that he remains the same?
Are you sure these values are going right for the
.Select()
? I made a Fiddle with them.– Leonel Sanches da Silva
@Gypsy omorrisonmendez I think your filde is not working no.
– Marconi
Already tried to convert to Decimal?
– Marconi
Doing what is in the answer below function. just put the
CultureInfo.InvariantCulture
.– MeuChapeu