我正在努力理解数组并阅读这个主题,但是当你刚刚开始编程并且没有人可以要求解释时,很多文献都不容易理解。这是我的二维数组:
'Declare 2-diensional array of Strings
Dim cars(,) As String =
New String(,) {{"BMW", "Coupe", "Reg:2015", "5 Door"},
{"Ford", "Focus", "Reg:2015", "3 Door"},
{"Land Rover", "Discovery", "Reg:2014", "5 Door"},
{"Vauxhall", "Astra", "Reg:2014", "3 Door"},
{"SEAT", "Ibiza", "Reg:2013", "5 Door"}}
' Get bounds of the array.
Dim bound0 As Integer = cars.GetUpperBound(0)
Dim bound1 As Integer = cars.GetUpperBound(1)
' Loop over all elements.
For i As Integer = 0 To bound0
For x As Integer = 0 To bound1
' Get element.
Dim s1 As String = cars(i, x)
Console.ForegroundColor = ConsoleColor.Green
Console.Write(s1 & ", ")
Next
Console.WriteLine()
Next
Console.ReadKey()
Console.WriteLine("Please enter the name of the record you wish to view")
Dim s = Console.ReadLine()
Dim value As String = Array.Find(cars, Function(x) (x.StartsWith(s)))
Console.WriteLine(value)
Console.ReadKey()
这是引起问题的线
Dim value As String = Array.Find(cars, Function(x) (x.StartsWith(s)))
Visual Studio建议错误是因为“无法从这些参数中推断出类型参数的数据类型。明确指定数据类型可能会纠正此错误。” 我无法理解这个错误意味着什么。请有人请解释一下,好像和一个10岁的孩子交谈,或者是一个可能帮助我理解这个问题的网站。谢谢