如何通过索引值查找字典的键? [英] How can I seek key of dictionary by index value?
本文介绍了如何通过索引值查找字典的键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过传递索引值来获取字典的键?
How can I get the key of a dictionary by passing the index value?
我正在尝试:
If rs.Fields("NM").Value = dictNM.key(0)
也就是说,我希望它与字典中的第一个键进行比较
that is, I want it to compare to the first key in the dictionary
但是我得到了错误
Compile error: Invalid use of property
我尝试了谷歌搜索,但无济于事.我希望这是可能的.
I tried googling, but to no avail. I'm hoping this is even possible.
推荐答案
您应该可以使用Keys属性:
You should be able to use the Keys property:
dictNM.Keys(0)
要记住的一件事是键的顺序未指定,请参见 MSDN
One thing to keep in mind is that the order of the keys is unspecified, see MSDN
这篇关于如何通过索引值查找字典的键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文