如何添加两个arraylist值 [英] how to add two arraylist values

查看:74
本文介绍了如何添加两个arraylist值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有两个arraylist,我想一次将它们添加到C#中的Dictionary类型.


这样的例子



i have two arraylist i want to adda them at a time to Dictionary type in the C#

example like

Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add("abc","xyz");
            dic.Add("def","ijk");




但是我需要添加两个arraylist的值.




but i need to add values of two arraylist

推荐答案

检查以下链接:

http://www.java2s.com/Tutorial/CSharp/0380__Generic/0040__Generic-List.htm [ ^ ]
check following link :

http://www.java2s.com/Tutorial/CSharp/0380__Generic/0040__Generic-List.htm[^]


这对您有帮助.

This MAy Help u.

string[] arr = new string[]
    {
        "One",
        "Two"
    };
    var dict = arr.ToDictionary(item => item, item => true);
    foreach (var pair in dict)
    {
        Console.WriteLine("{0}, {1}",
        pair.Key,
        pair.Value);
    }


这篇关于如何添加两个arraylist值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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