Converts value to an instance of targetType if necessary to e.g. avoid e.g. double/int cast exceptions.
This method mimics the behavior of the compiler that automatically performs casts like int to double in "Math.Sqrt(4)".
See about implicit, widening type conversions on MSDN - Type Conversion Tables
Note: targetType is expected to be a value type!