G
Guest
I have a function:
Public Sub Inverse(ByVal Source_Matrix As Double(,), ByRef
Destination_Matrix As Double(,))
Dim arrtemp(,) As Double = DirectCast(Source_Matrix, Double(,))
...........
For i = 1 To n
For j = n + 1 To 2 * n
arrtemp(i, j - n) = arrInv(i, j)
Next
Next
.......
End Function
"Source_Matrix" appears one time in this function - at the beginning as
shown above.
When the loop executes the array "Source_Matrix" changes to hold the new
values for arrtemp! (I know it occurs in this loop after step by step
execution).
The change carries through to the function caller. I don't think this is
quite right. It seems to me I made an initial assignment with the DirectCast
function (happens with CType also) not a permanent, unilateral marrage
between the two.
What's going on?
-
mark b
Public Sub Inverse(ByVal Source_Matrix As Double(,), ByRef
Destination_Matrix As Double(,))
Dim arrtemp(,) As Double = DirectCast(Source_Matrix, Double(,))
...........
For i = 1 To n
For j = n + 1 To 2 * n
arrtemp(i, j - n) = arrInv(i, j)
Next
Next
.......
End Function
"Source_Matrix" appears one time in this function - at the beginning as
shown above.
When the loop executes the array "Source_Matrix" changes to hold the new
values for arrtemp! (I know it occurs in this loop after step by step
execution).
The change carries through to the function caller. I don't think this is
quite right. It seems to me I made an initial assignment with the DirectCast
function (happens with CType also) not a permanent, unilateral marrage
between the two.
What's going on?
-
mark b