Visual Basic Bir Listede Birden Çok Olan Elemanları Göstermek

"Visual Basic" Programlama dilinde "Bir Listede Birden Çok Olan Elemanları Göstermek" ile ilgili kod örneği aşağıda belirtilmiştir.

Imports System
Imports System.Collections.Generic
Imports System.Linq

Module Program
    Sub Main(args As String())
        Dim sampleList As New List(Of Integer) From {10, 20, 60, 30, 20, 40, 30, 60, 70, 80}

        Dim duplicates As New List(Of Integer)()
        For Each item In sampleList.GroupBy(Function(x) x).Where(Function(g) g.Count() > 1)
            duplicates.Add(item.Key)
        Next

        Console.WriteLine(String.Join(", ", duplicates))
    End Sub
End Module



İlginizi Çekebilir

Visual Basic Bir Derecenin Tanjantını Bulma

Visual Basic String Compare Kullanımı

Visual Basic Dosyanın Klasör Yolunu Alma

Visual Basic Tek Satırda If Else Yazma

Visual Basic Dosya Varsa Oluşturmama Kontrolü