using System; namespace test { public class Test { public static void Main() { int[] a={1,2,3},b={2,3,4}; System.Collections.Hashtable ht=new System.Collections.Hashtable(); add(a,ht);add(b,ht); foreach(int o in ht.Keys) System.Console.WriteLine(o.ToString()); } private static void add(int[] o,System.Collections.Hashtable ht) { foreach(int one in o) if(!ht.Contains(one))ht.Add(one,one); } } }
namespace test
{
public class Test
{
public static void Main()
{
int[] a={1,2,3},b={2,3,4};
System.Collections.Hashtable ht=new System.Collections.Hashtable();
add(a,ht);add(b,ht);
foreach(int o in ht.Keys)
System.Console.WriteLine(o.ToString());
}
private static void add(int[] o,System.Collections.Hashtable ht)
{
foreach(int one in o)
if(!ht.Contains(one))ht.Add(one,one);
}
}
}