Howdy, I have a DataRow pulled out of a DataTable from a DataSet. I am accessing a column that is defined in SQL as a float datatype. I am trying to assign that value to
The reason it "doesn't feel right" is because C# uses the same syntax for unboxing and for casting, which are two very different things. exercise["DefaultAccelLimit"] contains a double value, boxed as an object. (double) is required to unbox the object back into a double. The (float) in front of that then casts the double to a float value. C# does not allow boxing and casting in the same operation, so you must unbox, then cast.
The same is true even if the cast is nondestructive. If a float was boxed as an object that you wanted to cast into a double, you would do it like so: (double)(float)object_var.