How to get only the unique words from array of strings in VB.NET

1 Answer

0 votes
Imports System
Imports System.Collections.Generic
Imports System.Linq

Public Class Program
    Public Shared Sub Main()
        Dim array As String() = {"c#", "c", "c++", "vb", "java", "c#", "java", "c", "python"}
		
        Dim unique_words As IEnumerable(Of String) = array.Distinct()

        For Each word In unique_words
            Console.WriteLine(word)
        Next
    End Sub
End Class





' run:
'
' c#
' c
' c++
' vb
' java
' python
' 

 



answered Feb 10, 2022 by avibootz

Related questions

1 answer 126 views
1 answer 115 views
1 answer 151 views
1 answer 144 views
3 answers 219 views
1 answer 121 views
...