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 231 views
1 answer 203 views
1 answer 243 views
1 answer 260 views
3 answers 408 views
1 answer 227 views
...