How to check if key exists in Dictionary with 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++")

        If dic.ContainsKey(2) Then
            Console.WriteLine("yes")
        End If

    End Sub

End Module

' run:
' 
' yes

 



answered Sep 26, 2018 by avibootz

Related questions

1 answer 180 views
1 answer 173 views
1 answer 171 views
2 answers 155 views
2 answers 166 views
...