循环 For Each
使用数组作为迭代变量,但初始化该数组。
错误 ID: BC32039
示例
下面的示例生成 BC32039:
Dim arrayList As New List(Of Integer())
For Each listElement(1) As Integer In arrayList
Next
更正此错误
从迭代变量的声明中删除初始化,如以下示例所示:
Dim arrayList As New List(Of Integer())
For Each listElement() As Integer In arrayList
Next
或者,可以使用类型推理:
Dim arrayList As New List(Of Integer())
For Each listElement In arrayList
Next