I am inputing this:
List<double> weightItems = new List<double> {0.23, 0.18, 0.18, 0.27, 0.14};
And when I output it like this:
objStr += "Weights: [" + String.Join(",", weightItems) + "]n";
return objStr;
And I am getting this as an output:
Weights: [0/23,0/18,0/18,0/27,0/14]
Not sure why I am getting this. Thank you for any help
2
Answers
First of all, lets modify this code a bit for it to compile:
This should return the following:
if this doesn’t work, it is probably because you have your CultureInfo set wrong.
To fix this issue, you should include this line before you using String.Join()
if you want to replecate this issue – include the same line with
"fa-Ir"
insteadWhich will change your results to the following:
lidqy posted a relevant link in the comments
lidqy’s link
If you’re afraid that the values are corrupted, you can easily display the values with ‘.’ as decimal point by specifiying for example InvariantCulture (or any other culture that uses a ‘.’ decimal separator).
Both outputs:
"Weights: [0.23,0.18,0.18,0.27,0.14]"