如何检查字典是否包含给定值? [英] How to check if a Dictionary contains a given value?
本文介绍了如何检查字典是否包含给定值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查Dictionary(Of int, String)
中是否存在某个值?
How do I check if a value exists in a Dictionary(Of int, String)
?
假设我有 [{1, 'One'};{2, 'Two'};{3, 'Three'}]
,如何检查两个"是否存在?
Let’s say I have [{1, 'One'};{2, 'Two'};{3, 'Three'}]
, how to check if ‘Two’ exists ?
推荐答案
您可以使用 ContainsValue
:
You can use ContainsValue
:
If myDictionary.ContainsValue("Two") Then
debug.print("Exists")
End If
这就是你所需要的.
这篇关于如何检查字典是否包含给定值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文