C#/.NET Little Pitfalls: The Dangers of Casting Boxed Values
- by James Michael Hare
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? 1: double pi = 3.14;
2: int theAnswer = 42;
…