从多个数组搜索 [英] Searching from Multiple Array
本文介绍了从多个数组搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在一个项目中工作,在该项目中,必须将完整的国家名称转换为国家/地区ISO代码.为此,我创建了两个数组
string [] arrayCntry = {"Australia","Austria",...};
string [] arrayISO = {"AUS","AUT",...};
现在的问题是,我无法匹配并获得各自国家的价值.请帮忙.任何更好的编码风格将不胜感激.
操作:如果找到"Australia",结果将返回"AUS".
Hi,
I am working for a project, where Full country name has to be converted to Country ISO Code. For this I have created two array
string[] arrayCntry = {"Australia", "Austria", ...};
string[] arrayISO = {"AUS", "AUT", ...};
Now the problem is that, I am unable to match and get the value of the respective country. Please Help. Any better coding style will be appreciated.
Action: If I find "Australia",result will return "AUS"
推荐答案
Hai,
是,您使用多个数组吗?
您不能使用字典或数据表
http://www.dotnetperls.com/dictionary [
Hai,
Y you use multiple arrays ?
y cant you use Dictionary, or Data Table
http://www.dotnetperls.com/dictionary[^]
使用Dictionary<string,>
(请参阅 ^ ])以获取详细信息(和示例代码).
Use a Dictionary<string,>
(see the documentation[^]) for details (and sample code).
这篇关于从多个数组搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文