How to add Hashtable Values to ArrayList in C#

1 Answer

0 votes
using System;
using System.Collections;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable hashtable = new Hashtable();

            hashtable.Add(100, "c#");
            hashtable.Add(101, "c");
            hashtable.Add(102, "c++");
            hashtable.Add(107, "java");

            ArrayList arrayList = new ArrayList(hashtable.Values);
            foreach (string value in arrayList)
                Console.WriteLine(value);
        }
    }
}


/*
run:
     
java
c++
c
c#
 
*/

 



answered Feb 20, 2017 by avibootz

Related questions

1 answer 228 views
228 views asked Feb 20, 2017 by avibootz
2 answers 221 views
1 answer 148 views
1 answer 178 views
2 answers 255 views
...