如何使用字典基于其键获取项目 [英] How to get item based on its key using dictionary

查看:60
本文介绍了如何使用字典基于其键获取项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



i我正在使用字典来存储带有数字的文件(即密钥)。如何根据密钥检索项目?请参考下面的内容代码。



dicfile.Add iPageNo,sReflowXMLPath& \& sFullPageName& .pdf



Dear Friends,

i am using dictionary to store files with number(ie.,key).how to retrieve items based on its key?please refer the below code.

dicfile.Add iPageNo, sReflowXMLPath & "\" & sFullPageName & ".pdf"

For Each colFile In dicfile
        qp.AddToFileList "listcol", dicfile(colFile)
       Next





而不是For Each使用字典键我需要获取值



instead of For Each using dictionary key i need to get values

推荐答案

这是字典方法 [ ^ ]。怎么样 TryGetValue [ ^ ]?
Here is a collection of Dictionary methods[^]. What about TryGetValue[^]?


这篇关于如何使用字典基于其键获取项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆