Here's my code:
var myString = "1234.56";
var myFloat = float.Parse(myString);
Console.WriteLine(myFloat);
The output now is
123456
But why? It shouldn't be 123456, it should be 1234.56 Why is it done wrong? Is it because I work on a German machine? But that would be crazy. What if I gave my code to someone with an English machine? Would it work correctly then?
Because the fun thing is that the following would give me the correct float number (but it shouldn't):
var myString = "1234,56"; // the German way to write floating numbers
var myFloat = float.Parse(myString);
Console.WriteLine(myFloat);
The output here is
1234,56 // yes, for some reason with a comma!
I'm very confused now...