Merge two IDictionary - CSharp System.Collections

CSharp examples for System.Collections:IDictionary

Description

Merge two IDictionary

Demo Code


using System.Collections;
using System;//from  w  w  w. ja va 2s. c  o  m

public class Main{
    public static void putAll(IDictionary dest, IDictionary source)
      {
         foreach (DictionaryEntry entry in source)
         {
            dest.Add(entry.Key, entry.Value);
         }
      }
    public static bool add(ICollection list, object value)
      {
         if (!((IList) list).Contains(value))
         {
            ((IList) list).Add(value);
            return true;
         }
         else
            return false;
      }
}

Related Tutorials