Selasa, 01 Februari 2011

C#/.NET Little Pitfalls: The Dangers of Casting Boxed Values

Starting a new series to parallel the Little Wonders series.  In this series, I will examine some of the small pitfalls that can occasionally trip up developers.Introduction: Of Casts and Conversions What happens when we try to assign from an int and a double and vice-versa?double pi = 3.14;int theAnswer = 42;// implicit widening conversion, compiles!double doubleAnswer = theAnswer;   // implicit

Tidak ada komentar:

Posting Komentar