0.5
is the way some country are writing decimal number, like in America. In France, decimal number are more written with a comma : 0,5
.
Typically, the code you give throw an exception on my computer.
You need to specify from what culture you are expected the string to be parse. If not, it will take your computer culture setting, which is bad, since your code could run in different countries.
So, by specifying an invariant culture, you said to the Parse function : ok, let's try to parse point or comma, try as hard as you can:
string yeah = "0.5";
float yeahFloat = float.Parse(yeah, CultureInfo.InvariantCulture);
Console.Write(yeahFloat);
There is a lot of question already on this subject :