G
Guest
I know I am being incredibly dunderheaded about this consider the following:
STRICT ON
Dim a(,) As Double = {{1, 2}, {3, 4}, {5, 6}}
Private Sub T1(ByVal a As Array)
Dim i, j As Integer
For i = 0 To 2
For j = 0 To 2
a(i, j) = 2 * a(i, j) Underlined as latebinding error
Next
Next
End Sub
My understanding of late binding is that it occurs when there is ambiguity
in the array as declared and there is subsequent specificity in an assignment
of that array. It seems to me that declaring this array as a two dimensional
array of double is pretty specific.
Evidently VB considers the array to be of sype system array in spite of its
having been declared as above. I have philosophically arrived at a place
where I accept this. From a utilitarian standpoint, I must now deal with it.
One idea, proposed in this forum, is to use the CType function, but alas my
interpretaion produces an error:
Private Sub T2(ByVal a As Array)
Dim i, j As Integer
Dim localC(,) As Double = CType(a, Double) Error*
For i = 0 To 2
For j = 0 To 2
localC(i, j) = 2 * localC(i, j)
Next
Next
End Sub
*system array cannot be converted to double
Strict off is not an option. Array.copy works, but is it the best way?
STRICT ON
Dim a(,) As Double = {{1, 2}, {3, 4}, {5, 6}}
Private Sub T1(ByVal a As Array)
Dim i, j As Integer
For i = 0 To 2
For j = 0 To 2
a(i, j) = 2 * a(i, j) Underlined as latebinding error
Next
Next
End Sub
My understanding of late binding is that it occurs when there is ambiguity
in the array as declared and there is subsequent specificity in an assignment
of that array. It seems to me that declaring this array as a two dimensional
array of double is pretty specific.
Evidently VB considers the array to be of sype system array in spite of its
having been declared as above. I have philosophically arrived at a place
where I accept this. From a utilitarian standpoint, I must now deal with it.
One idea, proposed in this forum, is to use the CType function, but alas my
interpretaion produces an error:
Private Sub T2(ByVal a As Array)
Dim i, j As Integer
Dim localC(,) As Double = CType(a, Double) Error*
For i = 0 To 2
For j = 0 To 2
localC(i, j) = 2 * localC(i, j)
Next
Next
End Sub
*system array cannot be converted to double
Strict off is not an option. Array.copy works, but is it the best way?