2017-05-19 74 views
0

这里是我的代码:VB.NET的indexOf没有找到字符串()

Dim list As New List(Of String)   
'populate list with string values 

Dim list2 As New List(Of String()) 

    For i As Integer = 0 To list.Count - 1 
     list2.Add({list.Item(i), "temp"}) 
    Next 

    for x as integer = 0 to list.count 
     Dim test1 = list2.indexof({list.item(x), "temp"}) '***this line is returning -1 
    next 

虽然我可以清楚地看到列表2在它的第一个索引包含字符串:

“加里”和“温度”

拒不退回的指数以外-1,当我搜索包含索引:

{ “加里”, “TEMP”}

回答

0

刚刚结束了我的代码重组,以避免这个问题 - 现在都很好。

我不确定为什么这不起作用;如果有人来寻找解决方案。