problem about directcast-Collection of common programming errors
Fl0
vb.net types casting directcast
In VB, i have different behaviour with DirectCast and casting into value type (double, int, …) depending of the number of indirectionDirectCast(nothing, Double)return 0But, if i try to cast something like a element of a matrix equals to nothing, there is an exceptionDim pArray as Object() = { nothing, 1.5, 2.27, -3.0} DirectCast(pArray(1), Double) ‘work with no issue DirectCast(pArray(0), Double) ‘Exception : Cannot convert to
Originally posted 2013-11-09 21:17:48.