次のコードでは、次のエラーが発生していますIf (Not hash.Add(Numbers(Num))) Then
'Integer'型の値を 'System.Array' 。私は間違って何をしていますか?VB.NET: 'Integer'型の値を 'System.Array'に変換できません
findDup
インサイド
Module Module1
Sub Main()
Dim array() As Integer = {5, 10, 12, 8, 8, 14}
' Pass array as argument.
Console.WriteLine(findDup(array))
End Sub
Function findDup(ByVal Numbers() As Integer) As Integer
Dim hash As HashSet(Of Array)
For Each Num In Numbers
If (Not hash.Add(Numbers(Num))) Then
Return (Num)
End If
Next
End Function
End Module
Num'が既に抽出された値である 'ので、(@shahkalpeshが応答した)現在のエラーに加えて、それは、あなたがAdd''への呼び出しで ''番号(NUM)を使用したいとは考えにくいのです'Numbers'配列から取得します。 –