Do you know your language? Solving the tiny C# quiz :-)
Impressive! Based on this feedback I should do more quizzes ;-) What do you think?
((floatobject)1.2F) is not *really* a float, but a float box. You're allowed to cast from float to double, but not from a boxed float to double. You can unbox to float and then convert that to a double via
double d = (double)((float)1.2F);
Details can be found at C# Programmer's Reference > Unboxing Conversion.
Cheers
Daniel
20071008, 23:58: Typo corrected. Thx Roger!
Comments
Anonymous
October 08, 2007
PingBack from http://msdnrss.thecoderblogs.com/2007/10/08/do-you-know-your-language-solving-the-tiny-c-quiz/Anonymous
October 08, 2007
PingBack from http://www.artofbam.com/wordpress/?p=6149Anonymous
October 08, 2007
PingBack from http://www.artofbam.com/wordpress/?p=6149Anonymous
October 08, 2007
"((float)1.2F) is not really a float" do you mean ((object)1.2F)?Anonymous
October 08, 2007
The comment has been removed