How to remove key from dictionary in VB.NET

1 Answer

0 votes
Module Module1

    Sub Main()

        Dim dic As New Dictionary(Of Integer, String)

        dic.Add(1, "VB.NET")
        dic.Add(2, "Java")
        dic.Add(5, "C++")
        dic.Add(9, "PHP")

        dic.Remove(5)

        For Each item As KeyValuePair(Of Integer, String) In dic
            Console.WriteLine("{0} : {1}", item.Key, item.Value)
        Next

    End Sub

End Module

' run:
' 
' 1 : VB.NET
' 2 : Java
' 9 : PHP

 



answered Sep 26, 2018 by avibootz

Related questions

2 answers 187 views
2 answers 157 views
1 answer 185 views
1 answer 125 views
1 answer 206 views
...