2 ms·
(0) you can forget to call "Dispose" but the benefit of using "using" is that Dispose will get called whichever way you get out of the scope. Using "using" for
by cm2187 10y ago
(0) you can forget to call "Dispose" but the benefit of using "using" is that Dispose will get called whichever way you get out of the scope. Using "using" for disposable types ends up being some reflex and it would seem odd to me to see new SqlConnection without a using.
(2) I am not sure I agree with that either. The following in VB6 returns 10, i.e. the second redim has created a new instance of an array:
Dim V() As String, W() As String
ReDim V(10)
W = V
ReDim V(20)
MsgBox UBound(W)
- catnaroek 10y ago(0) You can't forget to call “Dispose” if you need objects to be cleaned up in a specific order. (2) Try this: Dim V() As Long, W() As Long, i As Long ReDim V(1 To 10) For i = LBound(V) To UBound(V) V(i) = i Next i W = V For i = LBound(W) To UBound(W) W(i) = 2 * i Next i Call MsgBox(V(5)) Call MsgBox(W(5))