In the below code I am getting the following error on line If (Not hash.Add(Numbers(Num))) Then Value of Type ‘Integer’ cannot be converted to ‘System.Array’. What am I doing wrong?
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
Inside
findDup, thisShould be
EDIT: As suggested by @Damien_The_Unbeliever, the code
This line
Should be