Tuesday, August 4, 2015

Converting Data Types

A few years ago I came across a snippet of code that I immediately added to my arsenal.  Ask any developer and they will tell you that casting data from one type to another can sometimes be tricky and cause unwanted behavior.  That task becomes even more difficult when you throw in a database of some sort since not all databases support all data types.  With this in mind, this snippet of code has been in nearly every project I have worked on since.  While this snippet may not be new to all of you, I hope that it is to some.