How to check if value 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.ContainsValue("C++") Then
            Console.WriteLine("yes")
        End If

        ' case-sensitive
        If dic.ContainsValue("c++") Then
            Console.WriteLine("yes")
        Else
            Console.WriteLine("no")
        End If

    End Sub

End Module

' run:
' 
' yes
' no

 



answered Sep 26, 2018 by avibootz

Related questions

1 answer 195 views
2 answers 155 views
1 answer 163 views
1 answer 162 views
162 views asked May 2, 2022 by avibootz
1 answer 186 views
...