c#到vb.net转换的参数太少
在第一行,我得到了一个错误:system.collections.generic.list(of T)它必须是c#到vb.net转换的参数太少,.net,vb.net,.net,Vb.net,在第一行,我得到了一个错误:system.collections.generic.list(of T)它必须是system.collections.generic.list(of Object),其中Object是列表中包含的实际类型。我将这样写: Friend Shared Sub dumpRows(rowList As System.Collections.Generic.List, msg As [String]) msg = If((msg Is Nothing)
system.collections.generic.list(of Object)
,其中Object
是列表中包含的实际类型。我将这样写:
Friend Shared Sub dumpRows(rowList As System.Collections.Generic.List, msg As [String])
msg = If((msg Is Nothing), "***** ", "***** " & msg)
Dim row As [Object] = Nothing
info(vbLf & msg)
info("** Begin Row Dump:")
Dim iter As Iterator = rowList.iterator()
While iter.hasNext()
row = iter.[next]()
info(row.ToString())
End While
info("** End Row Dump." & vbLf)
End Sub
正如其他人所说,您需要声明列表包含的类型
其他一些注意事项:
我从前面删除了System.Collections.Generic
名称空间
因为我相信这个名称空间是由
违约你可能得把它加回去,但我怀疑
我不知道为什么您使用的转换工具在类名字符串
周围放了方括号。它们不是必需的
由于您基本上只是将msg
设置为在之前的内容前面有5个星号,因此可以使用合并
三元条件的。这使代码更简洁
如果只在While
循环中使用行,则没有理由在如此大的范围内声明行
我不使用VB.NET,但是您不应该指定列表的类型吗?这里有问题吗?
Friend Shared Sub dumpRows(rowList As List(Of Object), msg As String)
msg = "***** " & If(msg, String.Empty)
info(vbLf & msg)
info("** Begin Row Dump:")
Dim iter As Iterator = rowList.iterator()
While iter.hasNext()
Dim row As Object = iter.[next]()
info(row.ToString())
End While
info("** End Row Dump." & vbLf)
End Sub