新手请教一个有关Option Strict On设置下不允许后期绑定的问题
我是小神奇 2019-07-19 10:41:58 这是我的一个练习的代码:
Module Module1
Sub Main()
Dim a_row As New ArrayList
Dim x As Integer = 1
For a As Integer = 0 To 3
Dim a_col As New List(Of Integer)
For b As Integer = 0 To 4
a_col.Add(x)
x = x + 1
Next
a_row.Add(a_col)
Next
For i As Integer = 0 To a_row.Count - 1
For j As Integer = 0 To a_row(i).count - 1
Debug.Print("{0} type:{1}", a_row(i)(j), TypeName(a_row(i)(j)))
Next
Next
End Sub
End Module
如果设置Option Strict On的情况下,编译器都会对a_row(i),a_row(i)(j)这样的地方报错“不允许后期绑定”,这个问题除了设置Option Strict Off还有别的办法么?另外我这里a_col用的是泛型的List,已经指定了元素为integer类型了,还存在隐式转换的问题么?