Dim lstNum As New List(Of Integer)(New Integer() { 3, 6, 7, 9 })
Run Code Online (Sandbox Code Playgroud)
当我键入上面的代码行时,Visual Studio会通知我一个错误
'Microsoft.Office.Interop.Word.List'没有类型参数,因此不能有类型参数.
究竟是什么意思,我该如何解决?我似乎无法创建任何类型的列表.我假设我错过了一些导入但我不熟悉VB.Net足以知道该尝试什么.
使用Generic.List而不仅仅是List.
Dim lstNum As New Generic.List(Of Integer)(New Integer() { 3, 6, 7, 9 })
Run Code Online (Sandbox Code Playgroud)
由于您已导入Word interop,因此它正在尝试查找Word.List.指定Generic.List将告诉它超出该导入.
尝试添加System.Collections.Generic
Dim lstNum As New System.Collections.Generic.List(Of Integer)(New Integer() { 3, 6, 7, 9 })
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16535 次 |
| 最近记录: |