The proper workaround I think it should be to use Convert.ToByte(valueObject)
to retrieve the value from type object directly as a byte. It does perform the proper casting and returns a plain byte in one step.
About why it can't a straight cast directly, I'm not really sure, but I guess it has to do with the value object being boxed when stored in an object
variable, then it must be unboxed previously, and that unbox requires to be done to the same type it was originally, or a compatible one. Byte isn't compatible with double (as it has a wider range), so you can only unbox to a double (since the value is really a double), and then cast that double to a byte. The Convert
Class seems to do all that internally.
The unboxing reference is here: http://msdn.microsoft.com/library/b95fkada(v=vs.80).aspx