Пример #1
0
 static public DICT <K, V> .DictNode[] GetDictNodes <K, V>(DICT <K, V> dict)
 {
     K[] keys = dict.ToKeyArray(); DICT <K, V> .DictNode[] array = new DICT <K, V> .DictNode[dict.Count];
     for (int i = 0; i < dict.Count; i++)
     {
         array[i] = new DICT <K, V> .DictNode(keys[i], dict[keys[i]]);
     }
     keys = null;
     return(array);
 }
Пример #2
0
        static public DICT <T, V> Create <T, V>(params DICT <T, V> .DictNode[] nodes)
        {
            DICT <T, V> dict = new DICT <T, V>();

            if (nodes == null)
            {
                return(dict);
            }
            foreach (DICT <T, V> .DictNode node in nodes)
            {
                if (!dict.ContainsKey(node.Key))
                {
                    dict.Add(node.Key, node.Value);
                }
                else
                {
                    throw new ArgumentException("Dictonaries do not accept duplicate 'Keys'!");
                }
            }
            return(dict);
        }
Пример #3
0
 virtual public void Add(DICT <TKey, TValue> .DictNode item)
 {
     this.Add(item.Key, item.Value);
 }