singleton Map - CSharp System.Collections

CSharp examples for System.Collections:IDictionary

Description

singleton Map

Demo Code


using System.Collections;
using System;/*from w w w  . j  a  v a  2  s  .  c  o m*/

public class Main{
        public static IDictionary singletonMap(object key, object value)
      {
         IDictionary dictionary = new Hashtable();
         dictionary.Add(key, value);
         return dictionary;
      }
        public static bool add(ICollection list, object value)
      {
         if (!((IList) list).Contains(value))
         {
            ((IList) list).Add(value);
            return true;
         }
         else
            return false;
      }
}

Related Tutorials