How to count the array elements only once in VB.NET

1 Answer

0 votes
Imports System
Imports System.Linq

Public Class Program
    Public Shared Sub Main()
        Dim arr As Integer() = {4, 1, 2, 8, 9, 5, 1, 7, 8, 8, 8}
		
        Console.WriteLine(arr.Distinct().Count())
    End Sub
End Class

	
	

	
	
' run:
'	
' 7
'

 



answered Apr 18, 2022 by avibootz
...