String.Format culture

Jan 17, 2013 at 5:07 PM
Edited Jan 17, 2013 at 5:09 PM

UPDATE: Ignore me, someone already posted the same thing :)

In MidiFile.cs (latest source) on European non-English cultures it throws an exception as the 1.000 is changed to 1,000 and therefore does not match your const.


Can I suggest changing


string.Format("{0:0.000}", BANK_VERSION)))

to

string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:0.000}", BANK_VERSION)))

Coordinator
Jan 22, 2013 at 8:47 PM

Thank you, I think that if I switch to xml or serialization I can avoid such problems, but I would love to maintain readability.

Also I might just parse the float value and compare that to the constant. This way "v 1.0" or "v1" or "v1.00" will all be acceptable.