I must count the number of repeated numbers that can be in a list. I enter numbers by keyboard and at the end of the load, the loaded numbers are transferred to a list.
What I have is malfunctioning.
**Function NumerosRepetidos(ByRef listaNumeros As List(Of Byte), ByRef numero As Byte) As Long
listaNumeros.Add(numero)
Dim i, x As Long
x = -1
For i = 0 To listaNumeros.Count - 1
If numero = listaNumeros(i) Then
x += 1
End If
Console.WriteLine("El numero: {0}", numero, "se repitio " & x & " " & "veces.")
Next
Return numero
End Function**
What you are looking for can be done with a simple statement
LINQ
, which is used by importing the librarySystem.Linq
. You would have the following form:You can try the code in the following link .